summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/comp/parser_run.t10
-rw-r--r--toke.c2
2 files changed, 11 insertions, 1 deletions
diff --git a/t/comp/parser_run.t b/t/comp/parser_run.t
index 0fca5b2800..a2cc27d3fb 100644
--- a/t/comp/parser_run.t
+++ b/t/comp/parser_run.t
@@ -10,7 +10,7 @@ BEGIN {
}
require './test.pl';
-plan(2);
+plan(3);
# [perl #130814] can reallocate lineptr while looking ahead for
# "Missing $ on loop variable" diagnostic.
@@ -31,5 +31,13 @@ EOS
Unrecognized character \xD5; marked by <-- HERE after ${ <-- HERE near column 4 at - line 1.
EXPECT
+fresh_perl_is(<<'EOS', <<'EXPECTED', {}, "use after free (#131836)");
+${sub#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+EOS
+Missing right curly or square bracket at - line 1, at end of line
+syntax error at - line 1, at EOF
+Execution of - aborted due to compilation errors.
+EXPECTED
+
__END__
# ex: set ts=8 sts=4 sw=4 et:
diff --git a/toke.c b/toke.c
index 99b737ba0e..591b169b10 100644
--- a/toke.c
+++ b/toke.c
@@ -6222,8 +6222,10 @@ Perl_yylex(pTHX)
break;
}
if (strEQs(s, "sub")) {
+ PL_bufptr = s;
d = s + 3;
d = skipspace(d);
+ s = PL_bufptr;
if (*d == ':') {
PL_expect = XTERM;
break;