From 8672f831461dec8ec646927d6a63a727afcacea8 Mon Sep 17 00:00:00 2001 From: larpon <768942+larpon@users.noreply.github.com> Date: Fri, 26 Dec 2025 13:34:25 +0100 Subject: [PATCH] toml: fix unicode decoding panic on invalid TOML `key/duplicate-keys-06.toml` (#26140) --- vlib/toml/decoder/decoder.v | 2 +- vlib/toml/tests/toml_lang_test.v | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/vlib/toml/decoder/decoder.v b/vlib/toml/decoder/decoder.v index 3eeecc2e4..6037e3989 100644 --- a/vlib/toml/decoder/decoder.v +++ b/vlib/toml/decoder/decoder.v @@ -156,7 +156,7 @@ pub fn decode_quoted_escapes(mut q ast.Quoted) ! { mut slen := if is_valid_long { 10 } else { 6 } if slen <= s.remaining() { pos := s.state().pos - sequence := s.text[pos..pos + slen + 1] + sequence := s.text#[pos..pos + slen + 1] decoded, unicode_val, sequence_length = decode_unicode_escape(sequence) or { decoded_s += escape continue diff --git a/vlib/toml/tests/toml_lang_test.v b/vlib/toml/tests/toml_lang_test.v index 731331fde..90c508233 100644 --- a/vlib/toml/tests/toml_lang_test.v +++ b/vlib/toml/tests/toml_lang_test.v @@ -27,7 +27,6 @@ const valid_exceptions = [ // NOTE: entries in this list are tests of invalid TOML that should have the parser fail, but currently does not. const invalid_exceptions = [ 'do_not_remove', - 'key/duplicate-keys-06.toml', 'inline-table/duplicate-key-02.toml', 'string/multiline-escape-space-02.toml', 'string/missing-quotes-array.toml', -- 2.39.5