develooper Front page | perl.perl5.porters | Postings from October 2016

Re: [perl #129903] regexec.c stack overflow

Thread Previous | Thread Next
From:
demerphq
Date:
October 18, 2016 09:29
Subject:
Re: [perl #129903] regexec.c stack overflow
Message ID:
CANgJU+W_ZrPdEqnzONtJOyaEyJbbG4nO8nPkFJZMBA+xNna+xg@mail.gmail.com
On 18 October 2016 at 10:21, demerphq <demerphq@gmail.com> wrote:
> On 18 October 2016 at 10:17, demerphq <demerphq@gmail.com> wrote:
>> ... Apparently
>> the problem is related to the empty-pattern special case behavior.
> [...]
>>
>> This is definitely a bug.
>
> And yet another example of the empty pattern special case causing
> problems. Sigh, so much trouble for so little value.

Actually this case can be boiled down to:

./perl -le'/(?{ s!!! })/'

which causes an infinite loop due to PL_curpm being set at the start
of the match, which the s!!! then sees as the "last successful match".
IMO it shouldn't as the outer match hasn't actually finished yet, but
because of when and how we set up PL_curpm at match start we have this
problem inside of (?{ }) constructs.

I think we can fix it by checking PL_curpm against PL_reg_curpm when
we do the empty pattern check; running tests now.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About