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 20, 2016 07:41
Subject:
Re: [perl #129903] regexec.c stack overflow
Message ID:
CANgJU+U9j6sBxh5sEYkDW3SE3Y-8gY6gexAUOtGJUnKqT2JOTg@mail.gmail.com
On 20 October 2016 at 09:37, demerphq <demerphq@gmail.com> wrote:
> On 19 October 2016 at 23:29, demerphq <demerphq@gmail.com> wrote:
>> On 19 October 2016 at 22:51, Father Chrysostomos via RT
>>> Similarly, having m|(?{ // })| try to use the *current* pattern instead of the last pattern to match successfully—solely due to an implementation detail—seems wrong.
>>
>> Yes I agree.
>
> So following up for this I put together a quick hack to make it
> possible to use the empty pattern in regexen, but honestly I dont see
> how it is very useful, it is all too easy to create an infinite loop
> (which luckily seems to be easy to detect).
>
> ./perl -le'$_="aa"; /a/; /(?{ s!!x! })/; print; //; print'
> xa
> Infinite recursion via empty pattern at -e line 1.
>
> I personally think this is no less ugly than the previous patch, but
> if you prefer it I can push it.
>
> FWIW, this seems to be yet another good reason to get rid of the empty pattern.

Oh, here is another reason:

./perl -le'$_="ab"; my $p=qr/(?{ s!!x! })/; /$p/; print; /a/; /$p/;
print; /b/; /$p/; print; //;'
xab
xxb
xxx
Infinite recursion via empty pattern at -e line 1.

Crazy.


-- 
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