Bug#511589: foreach loop with lexically scoped variable result in segmentation fault

Niko Tyni ntyni at debian.org
Tue Jan 13 14:00:28 UTC 2009


reassign 511589 perl 5.10.0-19
severity 511589 important
tag 511589 fixed-upstream
thanks

On Mon, Jan 12, 2009 at 10:28:36PM +0200, Niko Tyni wrote:
> On Mon, Jan 12, 2009 at 03:28:26PM +0100, Peter Makholm wrote:
> > Package: libdevel-repl-perl
> > Version: 1.002001-2
> > Severity: normal
> > 
> > Using the same lexically scoped variable in a foreach loop twice, makes re.pl
> > crash with a segmentation fault:  
> 
> This looks like memory corruption in the Perl core, triggered by
> Lexical::Persistence:

> I'll reassign to perl once I have a core-only testcase.

Not quite core-only, it needs the Devel::LexAlias XS module.

#!/usr/bin/perl -w
use Devel::LexAlias qw(lexalias);
lexalias(
    \&func, '$foo', { foo => undef }
);
func();
func();
sub func {
    for my $foo ( 0 ) { print "/dir/$foo\n" }
}

Bisecting shows it was fixed in the Perl upstream development branches
(both blead and maint-5.10) with change 33080:

 http://perl5.git.perl.org/perl.git/commit/09edbca0f5c7caf9dd4acef80d8e6275e5a95ea1

Backporting this to 5.10.0 doesn't seem trivial.
-- 
Niko Tyni   ntyni at debian.org





More information about the pkg-perl-maintainers mailing list