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

[perl #129903] regexec.c stack overflow

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
October 19, 2016 20:52
Subject:
[perl #129903] regexec.c stack overflow
Message ID:
rt-4.0.24-23151-1476910315-952.129903-15-0@perl.org
On Wed Oct 19 00:23:19 2016, demerphq wrote:
> On 18 Oct 2016 23:46, "Father Chrysostomos via RT" <
> perlbug-followup@perl.org> wrote:
> > PL_curpm does far too many things.  This is not the only bug that results.
> 
> Can you expand on that thought a bit please?

Having PL_curpm point to the actual pattern in the op tree results in different recursion levels sharing the same set of match variables:

$u = ",echle etn sJ";
$t = "\nrka rPrhoatu";
$_ = $u.$t;
sub foo { s/(.)//s or return; bar(); print chop $$1 }
sub bar { s/(.)//s or return; foo(); print chop $$1 }
foo

(I thought I had reported this before, but I cannot find the ticket now.)

Using a qr// works.

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.

PL_curpm is serving three purposes: the last match op, the last set of matched buffers ($1 etc.), and the innermost pattern enclosing the currently executing code.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=129903

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