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

Re: [perl #114372] Panic in pure-Perl code with vanilla perl-5.16.0from perlbrew

Thread Previous | Thread Next
From:
Dennis Kaarsemaker
Date:
August 1, 2012 12:57
Subject:
Re: [perl #114372] Panic in pure-Perl code with vanilla perl-5.16.0from perlbrew
Message ID:
1343851026.3824.7.camel@localhost
On wo, 2012-08-01 at 12:09 -0700, Nicholas Clark via RT wrote:
> On Wed Aug 01 12:00:05 2012, shlomif@shlomifish.org wrote:
> 
> > shlomif@telaviv1:~$ bash reproduce.bash
> > [,,,]
> > [,,,26,,15,,6,29,]
> > [,,,,]
> > [,33,,33,,47,41,47,,]
> > panic: attempt to copy freed scalar 81b2f8 at -e line 1, <> line 5.
> > 
> > Further lines are not processed.
> 
> Interesting test case. It's not a new bug:
> 
> $ echo -e
> '[2,36,29,83]\n[30,81,55,15,68,26,71,29,6,46]\n[16,66,42,76,59]\n[65,47,65,47,74,33,41,38,75,59]\n[64,55,39,26,33,66]\n'
> | perl5.8.9 -pe '@h{@x=sort{$a<=>$b}/\d+/g}=reverse@x;s#\d+#$h{$&}#g'
> [,,,]
> [,,,26,,15,,6,29,]
> [,,,,]
> [,33,,33,,47,41,47,,]
> panic: attempt to copy freed scalar 1008195d0 to 1008195c0 at -e line 1,
> <> line 5.
> 
> (earlier versions seem to SEGV instead of panicing)
> 
> I suspect that the old contents of @x are getting freed whilst they
> are on the stack as a result of the reverse @x, causing the panic.

Actually, the reverse seems unrelated (or I've uncovered another bug). I
managed to reduce the testcase to: 

./perl  -e '@x = (1,2); @h{@x=sort}=@x'

-- 
Dennis Kaarsemaker, Systems Architect
Booking.com
Herengracht 597, 1017 CE Amsterdam
Tel external +31 (0) 20 715 3409
Tel internal (7207) 3409


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