Commit e1017a07e1 for perl
commit e1017a07e1e489719d9adfe57bbf6d2521effcf7
Author: Yves Orton <demerphq@gmail.com>
Date: Sun Oct 18 13:42:18 2026 +0200
regex: update both folded trie length bounds
A folded word can lower the minimum length and raise the maximum at the
same time. The else-if chain only updated the minimum in that case.
Update both bounds independently.
For eeeeee|a\xB5\xDFSss under /iu, the old maximum leaves the AC
position ring too small for the second word. We can miss the match or
fail an assertion.
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 60ac918de8..10aa12472e 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -431,6 +431,12 @@ manager will later use a regex to expand these into links.
=item *
+A folded regex trie now updates its minimum and maximum lengths independently.
+An alternative which changes both bounds could previously cause a valid
+match to be missed or an assertion failure during Aho-Corasick scanning.
+
+=item *
+
Case-insensitive trie prefix extraction no longer splits a multi-character
fold between regex nodes. For example, a UTF-8 flagged C<ssx|sy> pattern
under C</iu> now matches C<"\x{df}x">.
diff --git a/t/re/re_tests b/t/re/re_tests
index 13fd1ffd90..f4091a137c 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -2358,6 +2358,12 @@ a+X(*COMMIT)j aXaXj n - - - PLUS skip after (*COMMIT) [ASCII]
(?:(\x{100}\x{101}){2})* \x{100}\x{101} y ${\(defined($1) ? $1 : q(undef))} undef - failed UTF-8 iteration must not leave a capture
\A(?:([\x{100}-\x{103}]{2}){2})*\x{102}\x{102}\x{103}\x{103}\z \x{100}\x{100}\x{101}\x{101}\x{102}\x{102}\x{103}\x{103} y $1 \x{101}\x{101} - UTF-8 backtracking restores the capture
+# Folded alternatives can lower the minimum and raise the maximum together
+/eeeeee|a\xB5\xDFSss/iu ??a\xB5\xDFSssabZ y $-[0]:$+[0] 2:8 - AC ring covers the longest folded alternative
+/eeeeee|a\xB5\xDFSss|eeeeee/iu ??a\xB5\xDFSssabZ y $-[0]:$+[0] 2:8 - AC ring covers the longest folded alternative
+/eeeeee|a\xB5\xDFSss([a-z]?)/iu ??a\xB5\xDFSssabZ y $-[0]:$+[0] 2:9 - AC ring covers the longest folded alternative
+/a\xB5\xDFSss|eeeeee/iu ??a\xB5\xDFSssabZ y $-[0]:$+[0] 2:8 - AC ring covers the longest folded alternative
+
# GH #14387, GH #24946: negative assertions must discard their captures
\A(?!(a)b)a\z a y ${\(defined($1) ? $1 : q(undef))} undef - partial negative lookahead body
\A(?!(a)b)\1\z a n - - - backreference must not use a failed assertion capture