summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpider Boardman <spider@orb.nashua.nh.us>2001-05-28 02:39:12 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-28 15:11:16 +0000
commit8452ff4b8049a7286a3a2f0c012eeb26d0a32e0a (patch)
tree192d564827ec2bc4c973ac9985bdf0b8bca807f0
parentd151aa0ec14d76b1fc090f7a4c70252742dc3539 (diff)
downloadperl-8452ff4b8049a7286a3a2f0c012eeb26d0a32e0a.tar.gz
Re: [ID 20010422.005] perl -e '{s//${}/; //}' # segfaults on FreeBSD
Message-Id: <200105281039.GAA03962@Orb.Nashua.NH.US> p4raw-id: //depot/perl@10250
-rw-r--r--toke.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index 0781a9a4a3..febb820d6d 100644
--- a/toke.c
+++ b/toke.c
@@ -1043,6 +1043,7 @@ S_sublex_push(pTHX)
SAVEI32(PL_lex_inwhat);
SAVECOPLINE(PL_curcop);
SAVEPPTR(PL_bufptr);
+ SAVEPPTR(PL_bufend);
SAVEPPTR(PL_oldbufptr);
SAVEPPTR(PL_oldoldbufptr);
SAVEPPTR(PL_last_lop);
@@ -3227,8 +3228,16 @@ Perl_yylex(pTHX)
else
PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
s = skipspace(s);
- if (*s == '}')
+ if (*s == '}') {
+ if (PL_expect == XREF && PL_lex_state == LEX_INTERPNORMAL) {
+ PL_expect = XTERM;
+ /* This hack is to get the ${} in the message. */
+ PL_bufptr = s+1;
+ yyerror("syntax error");
+ break;
+ }
OPERATOR(HASHBRACK);
+ }
/* This hack serves to disambiguate a pair of curlies
* as being a block or an anon hash. Normally, expectation
* determines that, but in cases where we're not in a