Fix executing arybase::_tie_it() in Safe compartement

This commit is contained in:
Petr Písař 2017-08-09 14:07:20 +02:00
parent 5530822d05
commit f5d76e71ba
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,61 @@
From cb2fda94b02c5b7e8d16582410034f5a3dae526f Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 25 Jul 2017 16:21:22 +1000
Subject: [PATCH] (perl #131588) be a little more careful in arybase::_tie_it()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Original patch by John Leitch <john@autosectools.com>
Petr Pisar: Ported to 5.26.0.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
ext/arybase/arybase.xs | 10 ++++++----
ext/arybase/t/arybase.t | 4 +++-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/ext/arybase/arybase.xs b/ext/arybase/arybase.xs
index 880bbe3..216442a 100644
--- a/ext/arybase/arybase.xs
+++ b/ext/arybase/arybase.xs
@@ -438,10 +438,12 @@ _tie_it(SV *sv)
INIT:
GV * const gv = (GV *)sv;
CODE:
- if (GvSV(gv))
- /* This is *our* scalar now! */
- sv_unmagic(GvSV(gv), PERL_MAGIC_sv);
- tie(aTHX_ GvSVn(gv), NULL, GvSTASH(CvGV(cv)));
+ if (isGV(gv)) {
+ if (GvSV(gv))
+ /* This is *our* scalar now! */
+ sv_unmagic(GvSV(gv), PERL_MAGIC_sv);
+ tie(aTHX_ GvSVn(gv), NULL, GvSTASH(CvGV(cv)));
+ }
void
FETCH(...)
diff --git a/ext/arybase/t/arybase.t b/ext/arybase/t/arybase.t
index f3d3287..41e90df 100644
--- a/ext/arybase/t/arybase.t
+++ b/ext/arybase/t/arybase.t
@@ -4,7 +4,7 @@
# plus miscellaneous bug fix tests
no warnings 'deprecated';
-use Test::More tests => 7;
+use Test::More tests => 8;
sub outside_base_scope { return "${'['}" }
@@ -34,4 +34,6 @@ is $@, "That use of \$[ is unsupported at $f line $l.\n",
sub foo { my $x; $x = wait } # compilation of this routine used to crash
+ok eval { arybase::_tie_it(1); 1 }, "don't crash on bad call to _tie_it()";
+
1;
--
2.9.4

View File

@ -204,6 +204,10 @@ Patch50: perl-5.27.1-perl-131645-Fix-assert-fail-in-pp_sselect.patch
# Fix error message for "our sub foo::bar", RT#131679, in upstream after 5.27.1
Patch51: perl-5.27.1-perl-131679-Fix-our-sub-foo-bar-message.patch
# Fix executing arybase::_tie_it() in Safe compartement, RT#131588,
# not yet accepted by upstream
Patch52: perl-5.26.0-perl-131588-be-a-little-more-careful-in-arybase-_tie.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
@ -2785,6 +2789,7 @@ Perl extension for Version Objects
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch200 -p1
%patch201 -p1
@ -2821,6 +2826,7 @@ perl -x patchlevel.h \
'Fedora Patch49: Do not display too many bytes when reporting malformed UTF-8 character' \
'Fedora Patch50: Fix select called with a repeated magical variable (RT#131645)' \
'Fedora Patch51: Fix error message for "our sub foo::bar" (RT#131679)' \
'Fedora Patch52: Fix executing arybase::_tie_it() in Safe compartement (RT#131588)' \
'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}
@ -5113,6 +5119,7 @@ popd
- Do not display too many bytes when reporting malformed UTF-8 character
- Fix select called with a repeated magical variable (RT#131645)
- Fix error message for "our sub foo::bar" (RT#131679)
- Fix executing arybase::_tie_it() in Safe compartement (RT#131588)
* Sat Jul 29 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4:5.26.0-397
- Enable separate debuginfo back