develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #108276] C stack overflow in Perl_scalarvoid

From:
Father Chrysostomos via RT
Date:
January 20, 2012 09:38
Subject:
[perl #108276] C stack overflow in Perl_scalarvoid
Message ID:
rt-3.6.HEAD-14510-1327081128-71.108276-15-0@perl.org
On Mon Jan 16 03:51:55 2012, davem wrote:
> On Sun, Jan 15, 2012 at 10:35:14AM -0800, bulk 88 wrote:
> 
> The code can be simplified to the following:
> 
>     my $n = $ARGV[0];
>     die unless $n =~ /^\d+$/;
> 
>     my $code = 'my $i = 0; if ($i) { print }' . "\n";
>     $code .= 'elsif ($i) { print }' . "\n" for 1..$n;
>     eval $code;
> 
> segfaults for me on blead with n >= about 5000.
> 
> In blead, it's recursing in S_finalize_op rather than scalarvoid; not sure
> whether this is instead of or in addition to a scalarvoid problem.
> 

Without actually looking, I suspect it is in addition.

As I’m sure you already know, each elsif is nested inside the previous
one in the op tree.

So it looks as though at least S_finalize_op needs to be made iterative,
and probably scalarvoid, too.

And this results in a crash in op_free:

perl -e'eval "sub{".q"$a+"x shift . "}"' 500000

What else needs to be made iterative?

-- 

Father Chrysostomos


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



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