]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ucode: fix parsing \xHH and \0OOO escape sequences
authorFelix Fietkau <nbd@nbd.name>
Sun, 5 Oct 2025 09:30:48 +0000 (11:30 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sun, 5 Oct 2025 09:31:31 +0000 (11:31 +0200)
Both need to add add bytes, not UTF-8 sequences.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/utils/ucode/patches/100-lexer-fix-parsing-xHH-and-0OOO-escape-sequences.patch [new file with mode: 0644]

diff --git a/package/utils/ucode/patches/100-lexer-fix-parsing-xHH-and-0OOO-escape-sequences.patch b/package/utils/ucode/patches/100-lexer-fix-parsing-xHH-and-0OOO-escape-sequences.patch
new file mode 100644 (file)
index 0000000..7084525
--- /dev/null
@@ -0,0 +1,29 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Sun, 5 Oct 2025 11:25:15 +0200
+Subject: [PATCH] lexer: fix parsing \xHH and \0OOO escape sequences
+
+Both need to add add bytes, not UTF-8 sequences.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/lexer.c
++++ b/lexer.c
+@@ -277,7 +277,7 @@ parse_escape(uc_lexer_t *lex, const char
+                       code = code * 16 + hex(ch);
+               }
+-              append_utf8(lex, code);
++              uc_vector_push(&lex->buffer, code);
+       }
+       /* octal or letter */
+@@ -293,7 +293,7 @@ parse_escape(uc_lexer_t *lex, const char
+                       if (code > 255)
+                               return emit_op(lex, -3, TK_ERROR, ucv_string_new("Invalid escape sequence"));
+-                      append_utf8(lex, code);
++                      uc_vector_push(&lex->buffer, code);
+               }
+               /* ... no octal sequence, handle potential regex macros */