summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2015-11-24 14:52:31 +1100
committerTony Cook <tony@develop-help.com>2015-11-24 14:52:31 +1100
commitd3b9036e206e03f8b788b7eecad735d30f355745 (patch)
treeb042cf429e2be4c58bf3c3976b2dfbeec064340c /toke.c
parente8c18a8486f7e900511cc2df8d2617ceab9ce437 (diff)
downloadperl-d3b9036e206e03f8b788b7eecad735d30f355745.tar.gz
[perl #126443] make sure PL_oldbufptr is preserved in scan_heredoc()
This is later used to update PL_oldoldbufptr, if the token following the <<FOO is unexpected this causes S_no_op() to access an invalid *PL_oldoldbufptr.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index d665b3d088..6d6975c43b 100644
--- a/toke.c
+++ b/toke.c
@@ -9617,12 +9617,14 @@ S_scan_heredoc(pTHX_ char *s)
else
{
SV *linestr_save;
+ char *oldbufptr_save;
streaming:
sv_setpvs(tmpstr,""); /* avoid "uninitialized" warning */
term = PL_tokenbuf[1];
len--;
linestr_save = PL_linestr; /* must restore this afterwards */
d = s; /* and this */
+ oldbufptr_save = PL_oldbufptr;
PL_linestr = newSVpvs("");
PL_bufend = SvPVX(PL_linestr);
while (1) {
@@ -9639,6 +9641,7 @@ S_scan_heredoc(pTHX_ char *s)
restore PL_linestr. */
SvREFCNT_dec_NN(PL_linestr);
PL_linestr = linestr_save;
+ PL_oldbufptr = oldbufptr_save;
goto interminable;
}
CopLINE_set(PL_curcop, origline);
@@ -9673,6 +9676,7 @@ S_scan_heredoc(pTHX_ char *s)
PL_linestr = linestr_save;
PL_linestart = SvPVX(linestr_save);
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ PL_oldbufptr = oldbufptr_save;
s = d;
break;
}