summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2015-09-04 22:26:12 +0300
committerJames E Keenan <jkeenan@cpan.org>2015-09-17 18:42:29 -0400
commita293d0fd7883038d8dfef01528c7398ba246b5f9 (patch)
tree89f79b054c32ef90444ba30785c7138424ad5f82
parent152e735a42abd9c9c12520ff57881f2d034b194c (diff)
downloadperl-a293d0fd7883038d8dfef01528c7398ba246b5f9.tar.gz
Tentative fix for RT#125350 - AFL detected crash.
-rw-r--r--perly.c2
-rw-r--r--t/base/lex.t8
2 files changed, 8 insertions, 2 deletions
diff --git a/perly.c b/perly.c
index abb4d4e779..91b4c79886 100644
--- a/perly.c
+++ b/perly.c
@@ -213,7 +213,7 @@ S_clear_yystack(pTHX_ const yy_parser *parser)
if (yy_type_tab[yystos[ps->state]] == toketype_opval
&& ps->val.opval)
{
- if (ps->compcv != PL_compcv) {
+ if (ps->compcv && (ps->compcv != PL_compcv)) {
PL_compcv = ps->compcv;
PAD_SET_CUR_NOSAVE(CvPADLIST(PL_compcv), 1);
PL_comppad_name = PadlistNAMES(CvPADLIST(PL_compcv));
diff --git a/t/base/lex.t b/t/base/lex.t
index 47c6be84b7..981b2e58d2 100644
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..103\n";
+print "1..104\n";
$x = 'x';
@@ -517,3 +517,9 @@ eval q|s##[}#e|;
eval '0; qq{@{sub{]]}}}}}';
print "ok $test - 124385\n"; $test++;
}
+
+{
+ # Used to crash [perl #125350]
+ eval ('qq{@{[0}*sub{]]}}}=sub{0' . "\c[");
+ print "ok $test - 125350\n"; $test++;
+}