summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2015-02-21 22:24:20 -0800
committerFather Chrysostomos <sprout@cpan.org>2015-02-21 22:24:46 -0800
commit0f9d53bbcafba2b30e50a1ad22c7759be170e14a (patch)
treee09ad38199970704c5e3d900c9620da7976110dd /toke.c
parentd90f68193029ea3c44b13561f94dbc565e54b3f0 (diff)
downloadperl-0f9d53bbcafba2b30e50a1ad22c7759be170e14a.tar.gz
[perl #123893] Fix hang with "@{"
Commit v5.21.8-320-ge47d32d stopped code interpolated into quote-like operators from reading more lines of input, by making lex_next_chunk ignore the open filehandle and return false. That causes this block under case 0 in yylex to loop: if (!lex_next_chunk(fake_eof)) { CopLINE_dec(PL_curcop); s = PL_bufptr; TOKEN(';'); /* not infinite loop because rsfp is NULL now */ } (rsfp is not null there.) This commit makes it check for quote-like operators above, in the same place where it checks whether the file is open, to avoid falling through to this code that can loop. This changes the syntax errors for a couple of cases recently added to t/op/lex.t, though I think the error output is now more consis- tent overall.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index 9e0575c8bf..4910b6bb97 100644
--- a/toke.c
+++ b/toke.c
@@ -4624,7 +4624,8 @@ Perl_yylex(pTHX)
case 26:
goto fake_eof; /* emulate EOF on ^D or ^Z */
case 0:
- if (!PL_rsfp && (!PL_parser->filtered || s+1 < PL_bufend)) {
+ if ((!PL_rsfp || PL_lex_inwhat)
+ && (!PL_parser->filtered || s+1 < PL_bufend)) {
PL_last_uni = 0;
PL_last_lop = 0;
if (PL_lex_brackets &&