parser_run.t revision 1.1.1.1
1#!./perl 2 3# Parser tests that want test.pl, eg to use runperl() for tests to show 4# reads through invalid pointers. 5# Note that this should still be runnable under miniperl. 6 7BEGIN { 8 chdir 't' if -d 't'; 9 require './test.pl'; 10 set_up_inc( qw(. ../lib ) ); 11} 12 13plan(5); 14 15# [perl #130814] can reallocate lineptr while looking ahead for 16# "Missing $ on loop variable" diagnostic. 17my $result = fresh_perl( 18 " foreach m0\n\$" . ("0" x 0x2000), 19 { stderr => 1 }, 20); 21is($result . "\n", <<EXPECT); 22syntax error at - line 3, near "foreach m0 23" 24Identifier too long at - line 3. 25EXPECT 26 27fresh_perl_is(<<EOS, <<'EXPECT', {}, "linestart before bufptr"); 28\${ \xB6eeeeeeeeeeee 29'x 30EOS 31Unrecognized character \xB6; marked by <-- HERE after ${ <-- HERE near column 4 at - line 1. 32EXPECT 33 34fresh_perl_is(<<'EOS', <<'EXPECTED', {}, "use after free (#131836)"); 35${sub#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 36EOS 37Missing right curly or square bracket at - line 1, at end of line 38syntax error at - line 1, at EOF 39Execution of - aborted due to compilation errors. 40EXPECTED 41 42SKIP: 43{ 44 # [perl #131949] use after free 45 # detected by ASAN 46 # Win32 cmd.exe can't handle newlines well 47 skip("Need POSIXish", 1) if $^O eq "MSWin32"; 48 my $out = runperl(prog => "\@{ 0\n\n}", stderr => 1, non_portable => 1); 49 is($out, "", "check for ASAN use after free"); 50} 51 52fresh_perl_is('-C-', <<'EXPECTED', {}, "ambiguous unary operator check doesn't crash (#132433)"); 53Warning: Use of "-C-" without parentheses is ambiguous at - line 1. 54syntax error at - line 1, at EOF 55Execution of - aborted due to compilation errors. 56EXPECTED 57 58__END__ 59# ex: set ts=8 sts=4 sw=4 et: 60