summaryrefslogtreecommitdiff
path: root/t/base/lex.t
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2018-01-30 16:40:53 +1100
committerTony Cook <tony@develop-help.com>2018-02-06 09:13:31 +1100
commitbb4e4c3869d9fb6ee5bddd820c2a373601ecc310 (patch)
treecf7b4bcfcfc4d20c184e06a6dea9fff9bf8aed8b /t/base/lex.t
parent4bfb5532d393d56b18d13bc19f70f6f7a64ae781 (diff)
downloadperl-bb4e4c3869d9fb6ee5bddd820c2a373601ecc310.tar.gz
(perl #125351) abort parsing if parse errors happen in a sub lex
We've had a few reports of segmentation faults and other misbehaviour when sub-parsing, such as within interpolated expressions, fails. This change aborts compilation if anything complex enough to not be parsed by the lexer is compiled in a sub-parse *and* an error occurs within the sub-parse. An earlier version of this patch failed on simpler expressions, which caused many test failures, which this version doesn't (which may just mean we need more tests...)
Diffstat (limited to 't/base/lex.t')
-rw-r--r--t/base/lex.t11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/base/lex.t b/t/base/lex.t
index de33e7a688..414aa1fceb 100644
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..117\n";
+print "1..120\n";
$x = 'x';
@@ -557,6 +557,15 @@ eval q|s##[}#e|;
eval ('/@0{0*->@*/*]');
print "ok $test - 128171\n"; $test++;
}
+{
+ # various sub-parse recovery issues that crashed perl
+ eval 's//${sub{b{]]]{}#$/ sub{}';
+ print "ok $test - 132640\n"; $test++;
+ eval 'qq{@{sub{]]}}}};shift';
+ print "ok $test - 125351\n"; $test++;
+ eval 'qq{@{sub{]]}}}}-shift';
+ print "ok $test - 126192\n"; $test++;
+}
$foo = "WRONG"; $foo:: = "bar"; $bar = "baz";
print "not " unless "$foo::$bar" eq "barbaz";