diff options
author | David Mitchell <davem@iabyn.com> | 2017-12-20 13:07:46 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-01-31 18:26:18 +0000 |
commit | 8d629a78e79c19651f98fd50647911d78b7de698 (patch) | |
tree | 9db4ee23715bf87a0eb2bda2f737832b36cd6d2f | |
parent | d6189047176e14277a152d1c4456d167adda6969 (diff) | |
download | perl-8d629a78e79c19651f98fd50647911d78b7de698.tar.gz |
pp_warn: use MEXTEND rather than EXTEND
RT #132602
-rw-r--r-- | pp_sys.c | 2 | ||||
-rw-r--r-- | t/op/warn.t | 21 |
2 files changed, 21 insertions, 2 deletions
@@ -417,7 +417,7 @@ PP(pp_warn) } else if (SP == MARK) { exsv = &PL_sv_no; - EXTEND(SP, 1); + MEXTEND(SP, 1); SP = MARK + 1; } else { diff --git a/t/op/warn.t b/t/op/warn.t index 42b88f8424..0bf6967a60 100644 --- a/t/op/warn.t +++ b/t/op/warn.t @@ -7,7 +7,7 @@ BEGIN { set_up_inc('../lib'); } -plan 32; +plan 33; my @warnings; my $wa = []; my $ea = []; @@ -220,3 +220,22 @@ EOF } 1; +# RT #132602 pp_warn in scalar context was extending the stack then +# setting SP back to the old, freed stack frame + +fresh_perl_is(<<'EOF', "OK\n", {stderr => 1}, "RT #132602"); +$SIG{__WARN__} = sub {}; + +my (@a, @b); +for my $i (1..300) { + push @a, $i; + () = (@a, warn); +} + +# mess with the stack some more for ASan's benefit +for my $i (1..100) { + push @a, $i; + @b = @a; +} +print "OK\n"; +EOF |