Fix propagating non-string variables in an exception value

This commit is contained in:
Petr Písař 2019-08-07 13:57:45 +02:00
parent c303a0d3d1
commit 04bb682c86
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From 85d4e0a35b2d44cf06a9343d23a2f84b8ebb9024 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 17 Jul 2019 11:32:50 +1000
Subject: [PATCH] (perl #134291) propagate non-PVs in $@ in bare die()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
pp_sys.c | 2 +-
t/op/die.t | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/pp_sys.c b/pp_sys.c
index 0214367ea6..251527785e 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -498,7 +498,7 @@ PP(pp_die)
}
}
}
- else if (SvPOK(errsv) && SvCUR(errsv)) {
+ else if (SvOK(errsv) && (SvPV_nomg(errsv,len), len)) {
exsv = sv_mortalcopy(errsv);
sv_catpvs(exsv, "\t...propagated");
}
diff --git a/t/op/die.t b/t/op/die.t
index ef2b85f8f5..d6d7daffa5 100644
--- a/t/op/die.t
+++ b/t/op/die.t
@@ -6,7 +6,7 @@ BEGIN {
set_up_inc('../lib');
}
-plan tests => 20;
+plan tests => 21;
eval {
eval {
@@ -94,6 +94,10 @@ like($@, qr/\.{3}propagated at/, '... and appends a phrase');
local $SIG{__WARN__} = sub { $ok = 0 };
eval { undef $@; die };
is( $ok, 1, 'no warnings if $@ is undef' );
+
+ eval { $@ = 100; die };
+ like($@."", qr/100\t\.{3}propagated at/,
+ 'check non-PVs in $@ are propagated');
}
TODO: {
--
2.20.1

View File

@ -85,7 +85,7 @@ License: GPL+ or Artistic
Epoch: %{perl_epoch} Epoch: %{perl_epoch}
Version: %{perl_version} Version: %{perl_version}
# release number must be even higher, because dual-lived modules will be broken otherwise # release number must be even higher, because dual-lived modules will be broken otherwise
Release: 442%{?dist} Release: 443%{?dist}
Summary: Practical Extraction and Report Language Summary: Practical Extraction and Report Language
Url: https://www.perl.org/ Url: https://www.perl.org/
Source0: https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz Source0: https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz
@ -231,6 +231,10 @@ Patch42: perl-5.30.0-perl-134221-support-append-mode-for-open-.-undef.pat
Patch43: perl-5.31.1-perl-134221-support-append-mode-temp-files-on-Win32-.patch Patch43: perl-5.31.1-perl-134221-support-append-mode-temp-files-on-Win32-.patch
Patch44: perl-5.31.1-perl-134221-support-O_APPEND-for-open-.-undef-on-VMS.patch Patch44: perl-5.31.1-perl-134221-support-O_APPEND-for-open-.-undef-on-VMS.patch
# Fix propagating non-string variables in an exception value, RT#134291,
# fixed after 5.31.2
Patch45: perl-5.31.2-perl-134291-propagate-non-PVs-in-in-bare-die.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048 # 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 Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2797,6 +2801,7 @@ Perl extension for Version Objects
%patch42 -p1 %patch42 -p1
%patch43 -p1 %patch43 -p1
%patch44 -p1 %patch44 -p1
%patch45 -p1
%patch200 -p1 %patch200 -p1
%patch201 -p1 %patch201 -p1
@ -2848,6 +2853,7 @@ perl -x patchlevel.h \
'Fedora Patch42: Preserve append mode when opening anonymous files (RT#134221)' \ 'Fedora Patch42: Preserve append mode when opening anonymous files (RT#134221)' \
'Fedora Patch43: Preserve append mode when opening anonymous files (RT#134221)' \ 'Fedora Patch43: Preserve append mode when opening anonymous files (RT#134221)' \
'Fedora Patch44: Preserve append mode when opening anonymous files (RT#134221)' \ 'Fedora Patch44: Preserve append mode when opening anonymous files (RT#134221)' \
'Fedora Patch45: Fix propagating non-string variables in an exception value (RT#134291)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \ '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' \ 'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil} %{nil}
@ -5093,6 +5099,9 @@ popd
# Old changelog entries are preserved in CVS. # Old changelog entries are preserved in CVS.
%changelog %changelog
* Wed Aug 07 2019 Petr Pisar <ppisar@redhat.com> - 4:5.30.0-443
- Fix propagating non-string variables in an exception value (RT#134291)
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:5.30.0-442 * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4:5.30.0-442
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild