diff options
author | Tony Cook <tony@develop-help.com> | 2015-05-05 16:23:59 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-05-05 16:23:59 +1000 |
commit | b12396ac84cef7e23e1aac516fa676165ddfc790 (patch) | |
tree | 612a9d3ae16e682941f5a17137d25559b4ddf262 | |
parent | 57e88091a0a502716610aeeade5461e8e8a2192a (diff) | |
download | perl-b12396ac84cef7e23e1aac516fa676165ddfc790.tar.gz |
[perl #124187] don't call pad_findlex() on a NULL CV
-rw-r--r-- | pad.c | 4 | ||||
-rw-r--r-- | t/base/lex.t | 5 |
2 files changed, 9 insertions, 0 deletions
@@ -962,6 +962,10 @@ Perl_pad_findmy_pvn(pTHX_ const char *namepv, STRLEN namelen, U32 flags) Perl_croak(aTHX_ "panic: pad_findmy_pvn illegal flag bits 0x%" UVxf, (UV)flags); + /* compilation errors can zero PL_compcv */ + if (!PL_compcv) + return NOT_IN_PAD; + offset = pad_findlex(namepv, namelen, flags, PL_compcv, PL_cop_seqmax, 1, NULL, &out_pn, &out_flags); if ((PADOFFSET)offset != NOT_IN_PAD) diff --git a/t/base/lex.t b/t/base/lex.t index 0a07ab73c3..a34a508653 100644 --- a/t/base/lex.t +++ b/t/base/lex.t @@ -506,3 +506,8 @@ eval q|s##[}#e|; eval q|my($_);0=split|; eval q|my $_; @x = split|; } + +{ + # Used to crash [perl #124187] + eval q|qq{@{[{}}*sub{]]}}}=u|; +} |