}
use strict;
-plan(tests => 39);
+plan(tests => 40);
# heredoc without newline (#65838)
{},
"long terminator fails correctly"
);
+
+ # this would read freed memory
+ fresh_perl_like(
+ qq(0<<<<""0\n\n),
+ # valgrind and asan reports an error between these two lines
+ qr/^Number found where operator expected at - line 1, near "<<""0"\s+\(Missing operator/,
+ {},
+ "don't use an invalid oldoldbufptr"
+ );
}
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) {
restore PL_linestr. */
SvREFCNT_dec_NN(PL_linestr);
PL_linestr = linestr_save;
+ PL_oldbufptr = oldbufptr_save;
goto interminable;
}
CopLINE_set(PL_curcop, origline);
PL_linestr = linestr_save;
PL_linestart = SvPVX(linestr_save);
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ PL_oldbufptr = oldbufptr_save;
s = d;
break;
}