>From f8126d5275718c644cf67033789c94a7b098b1d4 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 8 Sep 2026 12:31:04 +0000 Subject: [PATCH 1/2] regex: fix BRE with backref to repetition under some conditions backtracking did not restart scanning for a match: regcomp(&re, "\\(.\\{1,3\\}\\)\\1", 0); regexec(&re, "foo", 0, 0, 0); regcomp(&re, "\\(..*.\\)\\1", 0); regexec(&re, "aababa", 0, 0, 0); regexec failed to match. found and fixed by tre upstream: https://github.com/laurikari/tre/commit/2f7dcec55d5941e8dfdee5e0db4f8111dace2dde --- src/regex/regexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regex/regexec.c b/src/regex/regexec.c index 253b0e14..8ca7c380 100644 --- a/src/regex/regexec.c +++ b/src/regex/regexec.c @@ -885,7 +885,7 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, { /* Try starting from a later position in the input string. */ /* Check for end of string. */ - if (next_c == L'\0') + if (next_c_start == L'\0') { break; } -- 2.52.0