summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2017-01-24 11:14:28 +1100
committerTony Cook <tony@develop-help.com>2017-01-24 11:14:28 +1100
commit71776ae4fad9a7659deefe0c2376d45b873ffd6a (patch)
tree34d9980ba16ab54b1c1b6b611f3f99f41a975de4
parent3c157b3cf0631c69ffa5aa2d55b9199bf93b22a9 (diff)
downloadperl-71776ae4fad9a7659deefe0c2376d45b873ffd6a.tar.gz
(perl #129274) avoid treating the # in $# as a comment intro
-rw-r--r--t/op/lex.t14
-rw-r--r--toke.c4
2 files changed, 16 insertions, 2 deletions
diff --git a/t/op/lex.t b/t/op/lex.t
index e50f0ebb65..c8ecf36cf2 100644
--- a/t/op/lex.t
+++ b/t/op/lex.t
@@ -7,7 +7,7 @@ use warnings;
BEGIN { chdir 't' if -d 't'; require './test.pl'; }
-plan(tests => 34);
+plan(tests => 35);
{
no warnings 'deprecated';
@@ -273,3 +273,15 @@ SKIP:
'[perl #129000] read before buffer'
);
}
+# probably only failed under ASAN
+fresh_perl_is(
+ "stat\tt\$#0",
+ <<'EOM',
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 1.
+Number found where operator expected at - line 1, near "$#0"
+ (Missing operator before 0?)
+Can't call method "t" on an undefined value at - line 1.
+EOM
+ {},
+ "[perl #129273] heap use after free or overflow"
+);
diff --git a/toke.c b/toke.c
index 10669de57d..ca06b7a3ab 100644
--- a/toke.c
+++ b/toke.c
@@ -4279,7 +4279,9 @@ S_intuit_method(pTHX_ char *start, SV *ioname, CV *cv)
if (cv || PL_last_lop_op == OP_PRINT || PL_last_lop_op == OP_SAY
|| isUPPER(*PL_tokenbuf))
return 0;
- s = skipspace(s);
+ /* this could be $# */
+ if (isSPACE(*s))
+ s = skipspace(s);
PL_bufptr = start;
PL_expect = XREF;
return *s == '(' ? FUNCMETH : METHOD;