summaryrefslogtreecommitdiff
path: root/t/comp/parser_run.t
blob: af35758beeaa1a6eadfe7f2f6ba445ec94761a5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!./perl

# Parser tests that want test.pl, eg to use runperl() for tests to show
# reads through invalid pointers.
# Note that this should still be runnable under miniperl.

BEGIN {
    @INC = qw(. ../lib );
    chdir 't' if -d 't';
}

require './test.pl';
plan(4);

# [perl #130814] can reallocate lineptr while looking ahead for
# "Missing $ on loop variable" diagnostic.
my $result = fresh_perl(
    " foreach m0\n\$" . ("0" x 0x2000),
    { stderr => 1 },
);
is($result . "\n", <<EXPECT);
syntax error at - line 3, near "foreach m0
"
Identifier too long at - line 3.
EXPECT

fresh_perl_is(<<EOS, <<'EXPECT', {}, "linestart before bufptr");
\${ \xD5eeeeeeeeeeee
'x
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

SKIP:
{
    # [perl #131949] use after free
    # detected by ASAN
    # Win32 cmd.exe can't handle newlines well
    skip("Need POSIXish", 1) if $^O eq "MSWin32";
    my $out = runperl(prog => "\@{ 0\n\n}", stderr => 1, non_portable => 1);
    is($out, "", "check for ASAN use after free");
}

__END__
# ex: set ts=8 sts=4 sw=4 et: