This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix RT #84294 /((\w+)(?{print $2})){2,2}/ problem
authorYves Orton <demerphq@gmail.com>
Sat, 12 Mar 2011 16:21:54 +0000 (17:21 +0100)
committerYves Orton <demerphq@gmail.com>
Sat, 12 Mar 2011 16:44:33 +0000 (17:44 +0100)
commit92e82afa16f5f1aa1b3e163f6d4656d14c44a4d2
treedfa390236bc22ee6e20dc9cb22912bf6b645b83e
parentd774cd11ba563c66e3199abfc3061bdc88e980e0
Fix RT #84294 /((\w+)(?{print $2})){2,2}/ problem

When we are doing a CURLYX/WHILEM loop and the min iterations is
larger than zero we were not saving the buffer state before each
iteration. This mean that partial matches would end up with strange
buffer pointers, with the start *after* the end point.

In more detail WHILEM has four exits, three of which as far as I could
tell would do a regcppush/regcppop in their state transitions, only one,
WHILEM_A_pre which is entered when (n < min) would not. And it is this state
that we repeatedly enter when performing A the min number of times.
When I made the logic similar to the handling of ( n < max ), the bug
went away, and as far as I can tell nothing else broke.

Review by Dave Mitchell required before release.
regexec.c
t/re/pat.t