summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_sys.c2
-rw-r--r--t/op/warn.t21
2 files changed, 21 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 5154b9baa8..4ae475d460 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -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