Fix extending a stack in Perl parser

This commit is contained in:
Petr Písař 2019-02-22 14:05:50 +01:00
parent 6f58f5f5a8
commit 4842f957bd
2 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,133 @@
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

View File

@ -257,6 +257,9 @@ Patch53: perl-5.28.1-perl-133782-set-magic-when-changing-R.patch
# Fix a race when loading XS modules, in upstream after 5.29.7
Patch54: perl-5.29.7-Perl_my_cxt_init-fix-potential-race-condition.patch
# Fix extending a stack in Perl parser, RT#133778, in upstream after 5.29.8
Patch55: perl-5.29.8-perl-133778-adjust-MARK-if-we-extend-the-stack-in-pp.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2864,6 +2867,7 @@ Perl extension for Version Objects
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch200 -p1
%patch201 -p1
@ -2911,6 +2915,7 @@ perl -x patchlevel.h \
'Fedora Patch52: Fix a crash when parsing #line directives with large numbers in eval (RT#131562)' \
'Fedora Patch53: Fix setting magic when changing $^R (RT#133782)' \
'Fedora Patch54: Fix a race when loading XS modules' \
'Fedora Patch55: Fix extending a stack in Perl parser (RT#133778)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -5204,6 +5209,7 @@ popd
(RT#131562)
- Fix setting magic when changing $^R (RT#133782)
- Fix a race when loading XS modules
- Fix extending a stack in Perl parser (RT#133778)
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:5.28.1-432
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild