perl/perl-5.29.8-perl-133778-adjust-MARK-if-we-extend-the-stack-in-pp.patch

134 lines
1.5 KiB
Diff
Raw Normal View History

2019-02-22 13:05:50 +00:00
From d81b77352f66acde60db1b056b8eb3321b7b55fe Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 6 Feb 2019 10:37:58 +1100
Subject: [PATCH] (perl #133778) adjust MARK if we extend the stack in
pp_repeat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
for a list repeat in scalar/void context
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
pp.c | 3 +-
t/op/repeat.t | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 85 insertions(+), 2 deletions(-)
diff --git a/pp.c b/pp.c
index 5965f1adc0..77dddcb8b3 100644
--- a/pp.c
+++ b/pp.c
@@ -1694,7 +1694,8 @@ PP(pp_repeat)
else {
dTOPss;
ASSUME(MARK + 1 == SP);
- XPUSHs(sv);
+ MEXTEND(SP, 1);
+ PUSHs(sv);
MARK[1] = &PL_sv_undef;
}
SP = MARK + 2;
diff --git a/t/op/repeat.t b/t/op/repeat.t
index 978916689b..fa7ce06904 100644
--- a/t/op/repeat.t
+++ b/t/op/repeat.t
@@ -6,7 +6,7 @@ BEGIN {
set_up_inc( '../lib' );
}
-plan(tests => 49);
+plan(tests => 50);
# compile time
@@ -192,3 +192,85 @@ fresh_perl_like(
eval q{() = (() or ((0) x 0)); 1};
is($@, "", "RT #130247");
+
+# yes, the newlines matter
+fresh_perl_is(<<'PERL', "", { stderr => 1 }, "(perl #133778) MARK mishandling");
+map{s[][];eval;0}<DATA>__END__
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+()x0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+PERL
--
2.20.1