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

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

Thread Next
From:
Nicholas Clark via RT
Date:
August 1, 2012 12:09
Subject:
[perl #114372] Panic in pure-Perl code with vanilla perl-5.16.0 from perlbrew
Message ID:
rt-3.6.HEAD-11172-1343848143-102.114372-15-0@perl.org
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.

Nicholas Clark


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

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