diff --git a/perl-5.25.2-uninit-warning-from-h-const-coredumped.patch b/perl-5.25.2-uninit-warning-from-h-const-coredumped.patch new file mode 100644 index 0000000..1433a9f --- /dev/null +++ b/perl-5.25.2-uninit-warning-from-h-const-coredumped.patch @@ -0,0 +1,74 @@ +From 55b6481ff87f84626ba01275708297a42a6537b1 Mon Sep 17 00:00:00 2001 +From: David Mitchell +Date: Tue, 21 Jun 2016 15:23:20 +0100 +Subject: [PATCH] uninit warning from $h{\const} coredumped +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The code that printed the the name and subscript of a hash element +in an "uninitialized variable" warning assumed that a constant +hash subscript would be SvPOK. Something like \1 is a constant, +but is ROK, not POK. SEGVs ensured. + +Signed-off-by: Petr Písař +--- + sv.c | 5 ++++- + t/op/hashwarn.t | 19 ++++++++++++++++++- + 2 files changed, 22 insertions(+), 2 deletions(-) + +diff --git a/sv.c b/sv.c +index 535ee8d..b0fdd15 100644 +--- a/sv.c ++++ b/sv.c +@@ -15683,9 +15683,12 @@ Perl_varname(pTHX_ const GV *const gv, const char gvtype, PADOFFSET targ, + + if (subscript_type == FUV_SUBSCRIPT_HASH) { + SV * const sv = newSV(0); ++ STRLEN len; ++ const char * const pv = SvPV_nomg_const((SV*)keyname, len); ++ + *SvPVX(name) = '$'; + Perl_sv_catpvf(aTHX_ name, "{%s}", +- pv_pretty(sv, SvPVX_const(keyname), SvCUR(keyname), 32, NULL, NULL, ++ pv_pretty(sv, pv, len, 32, NULL, NULL, + PERL_PV_PRETTY_DUMP | PERL_PV_ESCAPE_UNI_DETECT )); + SvREFCNT_dec_NN(sv); + } +diff --git a/t/op/hashwarn.t b/t/op/hashwarn.t +index a6a1de9..6d72244 100644 +--- a/t/op/hashwarn.t ++++ b/t/op/hashwarn.t +@@ -6,7 +6,7 @@ BEGIN { + } + + require './test.pl'; +-plan( tests => 16 ); ++plan( tests => 18 ); + + use strict; + use warnings; +@@ -71,3 +71,20 @@ my $fail_not_hr = 'Not a HASH reference at '; + cmp_ok(scalar(@warnings),'==',0,'pseudo-hash 2 count'); + cmp_ok(substr($@,0,length($fail_not_hr)),'eq',$fail_not_hr,'pseudo-hash 2 msg'); + } ++ ++# RT #128189 ++# this used to coredump ++ ++{ ++ @warnings = (); ++ my %h; ++ ++ no warnings; ++ use warnings qw(uninitialized); ++ ++ my $x = "$h{\1}"; ++ is(scalar @warnings, 1, "RT #128189 - 1 warning"); ++ like("@warnings", ++ qr/Use of uninitialized value \$h\{"SCALAR\(0x[\da-f]+\)"\}/, ++ "RT #128189 correct warning"); ++} +-- +2.5.5 + diff --git a/perl.spec b/perl.spec index bb0a9c4..942e0ee 100644 --- a/perl.spec +++ b/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: 367%{?dist} +Release: 368%{?dist} Epoch: %{perl_epoch} Summary: Practical Extraction and Report Language Group: Development/Languages @@ -125,6 +125,10 @@ Patch32: perl-5.25.1-perl-128316-preserve-errno-from-failed-system-calls. # after 5.25.1 Patch33: perl-5.24.0-fix-128109-do-not-move-RExC_open_parens-0-in-reginse.patch +# Do not use unitialized memory in $h{\const} warnings, RT#128189, +# in upstream after 5.25.2 +Patch34: perl-5.25.2-uninit-warning-from-h-const-coredumped.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 @@ -2777,6 +2781,7 @@ Perl extension for Version Objects %patch31 -p1 %patch32 -p1 %patch33 -p1 +%patch34 -p1 %patch200 -p1 %patch201 -p1 @@ -2801,6 +2806,7 @@ perl -x patchlevel.h \ 'Fedora Patch31: Fix a memory leak in compiling a POSIX class (RT#128313)' \ 'Fedora Patch32: Do not mangle errno from failed socket calls (RT#128316)' \ 'Fedora Patch33: Fix compiling regular expressions like /\X*(?0)/ (RT#128109)' \ + 'Fedora Patch34: Do not use unitialized memory in $h{\const} warnings (RT#128189)' \ '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} @@ -5067,6 +5073,9 @@ popd # Old changelog entries are preserved in CVS. %changelog +* Wed Jun 22 2016 Petr Pisar - 4:5.24.0-368 +- Do not use unitialized memory in $h{\const} warnings (RT#128189) + * Mon Jun 20 2016 Petr Pisar - 4:5.24.0-367 - Fix compiling regular expressions like /\X*(?0)/ (RT#128109)