summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-10-29 20:37:31 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-10-29 20:37:31 +0000
commitf2c3c2b138051ac43fa7bf09f6df22a716145c94 (patch)
treed3a173b0ef63342d042d4082a467b71e0c32401f /toke.c
parent5a3d019e6f0e42ddac00be4c2d4be330302b31d7 (diff)
downloadperl-f2c3c2b138051ac43fa7bf09f6df22a716145c94.tar.gz
Partial fix of bug [perl #17589] : prevent the parser to
segfault when encountering the erroneous construct "sub;". p4raw-id: //depot/perl@18072
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index d95b0a72bb..aff4549138 100644
--- a/toke.c
+++ b/toke.c
@@ -5057,6 +5057,8 @@ Perl_yylex(pTHX)
if (*s == ':' && s[1] != ':')
PL_expect = attrful;
+ else if (!have_name && *s != '{' && key == KEY_sub)
+ Perl_croak(aTHX_ "Illegal declaration of anonymous subroutine");
if (have_proto) {
PL_nextval[PL_nexttoke].opval =