From: Spider Boardman Date: Mon, 28 May 2001 06:39:12 +0000 (-0400) Subject: Re: [ID 20010422.005] perl -e '{s//${}/; //}' # segfaults on FreeBSD X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8452ff4b8049a7286a3a2f0c012eeb26d0a32e0a;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20010422.005] perl -e '{s//${}/; //}' # segfaults on FreeBSD Message-Id: <200105281039.GAA03962@Orb.Nashua.NH.US> p4raw-id: //depot/perl@10250 --- diff --git a/toke.c b/toke.c index 0781a9a..febb820 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