Fix a crash in "Subroutine redefined" warning
This commit is contained in:
parent
5d9c04077a
commit
f5cb3d39f8
76
perl-5.25.2-SEGV-in-Subroutine-redefined-warning.patch
Normal file
76
perl-5.25.2-SEGV-in-Subroutine-redefined-warning.patch
Normal file
@ -0,0 +1,76 @@
|
||||
From fc0fe26a7d286480c1bb25f57e469ece575bb68d Mon Sep 17 00:00:00 2001
|
||||
From: David Mitchell <davem@iabyn.com>
|
||||
Date: Thu, 7 Jul 2016 17:03:29 +0100
|
||||
Subject: [PATCH] SEGV in "Subroutine redefined" warning
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RT #128257
|
||||
|
||||
The following SEGVed:
|
||||
|
||||
sub P::f{}
|
||||
undef *P::;
|
||||
*P::f =sub{};
|
||||
|
||||
due to the code which generates the "Subroutine STASH::NAME redefined"
|
||||
warning assuming that the GV always has a stash. Make it so that if it
|
||||
hasn't, the message changes to "Subroutine NAME redefined" rather than
|
||||
just crashing.
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
sv.c | 18 +++++++++++-------
|
||||
t/lib/warnings/sv | 8 ++++++++
|
||||
2 files changed, 19 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/sv.c b/sv.c
|
||||
index 1b7a283..0cbe371 100644
|
||||
--- a/sv.c
|
||||
+++ b/sv.c
|
||||
@@ -4074,14 +4074,18 @@ Perl_gv_setref(pTHX_ SV *const dstr, SV *const sstr)
|
||||
CvCONST((const CV *)sref)
|
||||
? cv_const_sv((const CV *)sref)
|
||||
: NULL;
|
||||
+ HV * const stash = GvSTASH((const GV *)dstr);
|
||||
report_redefined_cv(
|
||||
- sv_2mortal(Perl_newSVpvf(aTHX_
|
||||
- "%"HEKf"::%"HEKf,
|
||||
- HEKfARG(
|
||||
- HvNAME_HEK(GvSTASH((const GV *)dstr))
|
||||
- ),
|
||||
- HEKfARG(GvENAME_HEK(MUTABLE_GV(dstr)))
|
||||
- )),
|
||||
+ sv_2mortal(
|
||||
+ stash
|
||||
+ ? Perl_newSVpvf(aTHX_
|
||||
+ "%"HEKf"::%"HEKf,
|
||||
+ HEKfARG(HvNAME_HEK(stash)),
|
||||
+ HEKfARG(GvENAME_HEK(MUTABLE_GV(dstr))))
|
||||
+ : Perl_newSVpvf(aTHX_
|
||||
+ "%"HEKf,
|
||||
+ HEKfARG(GvENAME_HEK(MUTABLE_GV(dstr))))
|
||||
+ ),
|
||||
cv,
|
||||
CvCONST((const CV *)sref) ? &new_const_sv : NULL
|
||||
);
|
||||
diff --git a/t/lib/warnings/sv b/t/lib/warnings/sv
|
||||
index 5ddd4fe..c8e0e62 100644
|
||||
--- a/t/lib/warnings/sv
|
||||
+++ b/t/lib/warnings/sv
|
||||
@@ -413,3 +413,11 @@ Argument "a_c" isn't numeric in preincrement (++) at - line 5.
|
||||
Argument "(?^:abc)" isn't numeric in preincrement (++) at - line 6.
|
||||
Argument "123x" isn't numeric in preincrement (++) at - line 7.
|
||||
Argument "123e" isn't numeric in preincrement (++) at - line 8.
|
||||
+########
|
||||
+# RT #128257 This used to SEGV
|
||||
+use warnings;
|
||||
+sub Foo::f {}
|
||||
+undef *Foo::;
|
||||
+*Foo::f =sub {};
|
||||
+EXPECT
|
||||
+Subroutine f redefined at - line 5.
|
||||
--
|
||||
2.5.5
|
||||
|
11
perl.spec
11
perl.spec
@ -28,7 +28,7 @@
|
||||
Name: perl
|
||||
Version: %{perl_version}
|
||||
# release number must be even higher, because dual-lived modules will be broken otherwise
|
||||
Release: 372%{?dist}
|
||||
Release: 373%{?dist}
|
||||
Epoch: %{perl_epoch}
|
||||
Summary: Practical Extraction and Report Language
|
||||
Group: Development/Languages
|
||||
@ -150,6 +150,10 @@ Patch39: perl-5.25.2-Don-t-let-XSLoader-load-relative-paths.patch
|
||||
# in upstream after 5.25.2
|
||||
Patch40: perl-5.25.2-perl-128532-Crash-vivifying-stub-in-deleted-pkg.patch
|
||||
|
||||
# Fix a crash in "Subroutine redefined" warning, RT#128257,
|
||||
# in upstream after 5.25.2
|
||||
Patch41: perl-5.25.2-SEGV-in-Subroutine-redefined-warning.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
|
||||
|
||||
@ -2809,6 +2813,7 @@ Perl extension for Version Objects
|
||||
%patch38 -p1
|
||||
%patch39 -p1
|
||||
%patch40 -p1
|
||||
%patch41 -p1
|
||||
%patch200 -p1
|
||||
%patch201 -p1
|
||||
|
||||
@ -2840,6 +2845,7 @@ perl -x patchlevel.h \
|
||||
'Fedora Patch38: Fix line numbers with perl -x (RT#128508)' \
|
||||
'Fedora Patch39: Do not let XSLoader load relative paths (RT#115808)' \
|
||||
'Fedora Patch40: Fix a crash when vivifying a stub in a deleted package (RT#128532)' \
|
||||
'Fedora Patch41: Fix a crash in "Subroutine redefined" warning (RT#128257)' \
|
||||
'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}
|
||||
@ -5106,6 +5112,9 @@ popd
|
||||
|
||||
# Old changelog entries are preserved in CVS.
|
||||
%changelog
|
||||
* Fri Jul 08 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-373
|
||||
- Fix a crash in "Subroutine redefined" warning (RT#128257)
|
||||
|
||||
* Thu Jul 07 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-372
|
||||
- Fix a crash when vivifying a stub in a deleted package (RT#128532)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user