diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2006-12-10 18:50:05 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2006-12-10 18:50:05 +0000 |
commit | 2af555bf3f2b3ca8e114df3f5f680d40bd24d6bf (patch) | |
tree | ab3bfe43c56cfe0d9f676a1fb13e2614325893ee /t/comp | |
parent | d5c6462ec54f07680e7532435b71727ae3075024 (diff) | |
download | perl-2af555bf3f2b3ca8e114df3f5f680d40bd24d6bf.tar.gz |
#28315 could crash when freeing ops with different pads
Add hook to parser to record current PL_comppad, then use this
when popping ops off the parser stack after parser error
p4raw-id: //depot/perl@29501
Diffstat (limited to 't/comp')
-rw-r--r-- | t/comp/parser.t | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t index 2599bdf5b3..55c645987f 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -9,7 +9,7 @@ BEGIN { } BEGIN { require "./test.pl"; } -plan( tests => 60 ); +plan( tests => 62 ); eval '%@x=0;'; like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); @@ -210,3 +210,20 @@ like( $@, qr/Assignment to both a list and a scalar/, 'Assignment to both a list eval q{ s/x/#/e }; is( $@, '', 'comments in s///e' ); + +# these two used to coredump because the op cleanup on parse error could +# be to the wrong pad + +eval q[ + sub { our $a= 1;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a;$a; + sub { my $z +]; + +like($@, qr/Missing right curly/, 'nested sub syntax error' ); + +eval q[ + sub { my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s,$r); + sub { my $z +]; +like($@, qr/Missing right curly/, 'nested sub syntax error 2' ); + |