This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make op.c:S_find_and_forget_pmops() non-recursive
authorDavid Mitchell <davem@iabyn.com>
Fri, 31 May 2019 15:53:42 +0000 (16:53 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 24 Jun 2019 10:40:07 +0000 (11:40 +0100)
commitf0d08550371fd1ddd8c85e309492802884a5a804
tree90dfe21348a1d2267005ddd5d5cc179b0c865fae
parentb0a7849dfb8094e767cc24bc20d8a8f704e899dd
make op.c:S_find_and_forget_pmops() non-recursive

For every CV that's freed which has a shared optree (e.g. a closure
or between threads), the whole optree is walked looking for PMOPs.
Make that walk non-recursive.

Contrived code that triggers a stack overflow:

{
    my $outer;
    my $e = 'sub { $outer && '
            . join('&&', ('$x') x 100_000)
            . " }";
    #print $e, "\n";
    eval $e;
}

Even after this commit, that code still SEGVs due to a separate stack
blow in Perl_rpeep().
op.c