From 7bd7bdad687e5f790afda6f0f22444f3a169a6b1 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 28 Jun 2026 13:44:41 +0200 Subject: fixed ^EGq (character class) pattern construct for embedded null bytes and `-` This was using g_regex_escape_string() which always translates a null byte to `\0`, which is ambiguous if followed by other digits, so a null byte followed by a digit would result in a wrong regular expression. Actually the same could happen outside of character classes, ie. `@S/^@1/` was also broken. Also it does not escape `-`, so the result cannot be used in character classes. This is fixed now in a new custom implementation teco_regex_escape(). Once moving to a custom terex lexer, we won't need any of this of course unless we want to provide a regex escaping string building construct. We are now completely free of GRegex. --- tests/testsuite.at | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index a97e0f8..98425d1 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -515,6 +515,11 @@ AT_SETUP([Search for one of characters in uninitialized Q-Register]) TE_CHECK([[:@S/^EGa/"S(0/0)']], 0, ignore, ignore) AT_CLEANUP +AT_SETUP([Search for class with special characters]) +# Relevant when patterns are internally converted to regular expressions. +TE_CHECK([[![! @I/^@-]B/J ![! @EUc/^@1]A-C/ ::@S/^EM^EGc/"F(0/0)' ^S+3"N(0/0)']], 0, ignore, ignore) +AT_CLEANUP + AT_SETUP([Search accesses wrong Q-Register table]) TE_CHECK([[@^U.#xx/123/ @^Um{:@S/^EG.#xx/$} :Mm Mm]], 1, ignore, ignore) AT_CLEANUP -- cgit v1.2.3