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
commit904d85c5b9ccc833788234557fda3bc74a77ca8b (patch)
treed3a173b0ef63342d042d4082a467b71e0c32401f /toke.c
parentb8370f2a62ce28c9808787355d168ac28a1aaa1c (diff)
downloadperl-904d85c5b9ccc833788234557fda3bc74a77ca8b.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 =