diff options
author | Tony Cook <tony@develop-help.com> | 2015-11-24 14:52:31 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-11-24 14:52:31 +1100 |
commit | d3b9036e206e03f8b788b7eecad735d30f355745 (patch) | |
tree | b042cf429e2be4c58bf3c3976b2dfbeec064340c /toke.c | |
parent | e8c18a8486f7e900511cc2df8d2617ceab9ce437 (diff) | |
download | perl-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.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; } |