summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorPeter Martini <PeterCMartini@GMail.com>2013-03-03 00:09:58 +0000
committerDavid Mitchell <davem@iabyn.com>2013-03-03 00:25:13 +0000
commit89e006ae4e39db68ad35c878eb6e6de83ebd8ec9 (patch)
tree0b1dd9aff102daa5cbff60b5fad1d8a0ab848bdd /toke.c
parenta429ddf7a2c14de7caaf9248c6a79212167468f9 (diff)
downloadperl-89e006ae4e39db68ad35c878eb6e6de83ebd8ec9.tar.gz
Stop SEGV on 'our sub { syntax error }'
Fix for RT #116981. If a sub is declared with our, the name is added to the stash early, and left with a NULL ptr if there's a syntax error while compiling it. Since the only time it becomes an issue is when that same name is used in the same scope after a syntax error, what happens in the pad is not particularly important. The simple fix is to simply fall back to treating it like a bareword, and pretending it was never added to the pad in the first place.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index aace60b720..006f885288 100644
--- a/toke.c
+++ b/toke.c
@@ -6900,6 +6900,11 @@ Perl_yylex(pTHX)
gv = gv_fetchsv(sv, GV_NOADD_NOINIT | SvUTF8(sv),
SVt_PVCV);
off = 0;
+ if (!gv) {
+ sv_free(sv);
+ sv = NULL;
+ goto just_a_word;
+ }
}
else {
rv2cv_op = newOP(OP_PADANY, 0);