Branch: refs/heads/yves/fix_24816
  Home:   https://github.com/Perl/perl5
  Commit: 60cfff3b07e2f5e9b421725ad4a07b33416781c2
      
https://github.com/Perl/perl5/commit/60cfff3b07e2f5e9b421725ad4a07b33416781c2
  Author: Yves Orton <[email protected]>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    M regcomp.h
    M regcomp_trie.c
    M regexec.c
    M t/re/regexp.t

  Log Message:
  -----------
  regcomp_trie: make octet trie lookups always valid

Reserve transition slot zero and give the root state the complete octet
frame at slots 1 through 256.  Other states can reuse unoccupied root
slots.  Each state base maps octet zero to a non-zero slot and is one
past that state's highest possible lookup.

Track the highest required lookup separately from the packed high-water
mark.  Grow and zero the table when a placement needs more frame space.
This makes every executor and Aho-Corasick lookup address allocated,
zeroed transition storage without a bounds check.

The list compiler previously recorded a slot after a sparse frame in
lasttrans without always allocating or clearing it.  A lookup could
therefore treat uninitialized transition data as belonging to its state
and use an arbitrary next state.

This fixes GH #24816, which was reported during GH #24814.  It caused
intermittent failures immediately after test 2221 on Windows and
Cygwin.

Pass decoded and folded input to the trie as UTF-8 octets on every
non-raw path.  Raw paths already consume input octets directly.  This
removes the remaining character-ID mapping and its range checks.

Aho-Corasick construction uses the same table.  Preserve its root
fallback for a missing transition, as it terminates failure-link
traversal.  Validate state and transition indexes under DEBUG_r.  Move
that block outside DEBUG_r when validation is wanted in every full
DEBUGGING build.

Let regexp.t select an inclusive range of re_tests input lines while
retaining its original TAP numbering.  This makes the triggering cases
practical to stress independently.

The re_tests lines 2221 through 2222 also pass with 100,000 iterations,
including under ASAN with a refcounted stack (PERL_RC_STACK).

Under C<use re 'debug'>  compilation also exercises the transition
validation, so if you suspect a related bug try the pattern under
that pragma.



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to