Do not treat %: as a stash
This commit is contained in:
parent
59d5062095
commit
751d6acb17
@ -0,0 +1,64 @@
|
||||
From e7acdfe976f01ee0d1ba31b3b1db61454a72d6c9 Mon Sep 17 00:00:00 2001
|
||||
From: David Mitchell <davem@iabyn.com>
|
||||
Date: Tue, 21 Jun 2016 17:06:52 +0100
|
||||
Subject: [PATCH] only treat stash entries with .*:: as sub-stashes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RT #128238
|
||||
|
||||
%: = 0 would cause an assertion failure in Perl_gv_check(), since when
|
||||
it searched a stash for substashes, it assumed anything ending in ':' was
|
||||
a substash, whereas substashes end in '::'. So check for a double colon
|
||||
before recursing.
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
gv.c | 5 ++++-
|
||||
t/op/stash.t | 9 ++++++++-
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gv.c b/gv.c
|
||||
index 4df3bce..2b3bdfa 100644
|
||||
--- a/gv.c
|
||||
+++ b/gv.c
|
||||
@@ -2423,7 +2423,10 @@ Perl_gv_check(pTHX_ HV *stash)
|
||||
for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
|
||||
GV *gv;
|
||||
HV *hv;
|
||||
- if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
|
||||
+ STRLEN keylen = HeKLEN(entry);
|
||||
+ const char * const key = HeKEY(entry);
|
||||
+
|
||||
+ if (keylen >= 2 && key[keylen-2] == ':' && key[keylen-1] == ':' &&
|
||||
(gv = MUTABLE_GV(HeVAL(entry))) && isGV(gv) && (hv = GvHV(gv)))
|
||||
{
|
||||
if (hv != PL_defstash && hv != stash
|
||||
diff --git a/t/op/stash.t b/t/op/stash.t
|
||||
index b8e0f34..ec795a9 100644
|
||||
--- a/t/op/stash.t
|
||||
+++ b/t/op/stash.t
|
||||
@@ -7,7 +7,7 @@ BEGIN {
|
||||
|
||||
BEGIN { require "./test.pl"; }
|
||||
|
||||
-plan( tests => 52 );
|
||||
+plan( tests => 53 );
|
||||
|
||||
# Used to segfault (bug #15479)
|
||||
fresh_perl_like(
|
||||
@@ -341,3 +341,10 @@ is runperl(
|
||||
),
|
||||
"ok\n",
|
||||
'[perl #128086] no crash from assigning hash to *:::::: & deleting it';
|
||||
+
|
||||
+is runperl(
|
||||
+ prog => 'BEGIN { %: = 0; $^W=1}; print qq|ok\n|',
|
||||
+ stderr => 1,
|
||||
+ ),
|
||||
+ "ok\n",
|
||||
+ "[perl #128238] don't treat %: as a stash (needs 2 colons)"
|
||||
--
|
||||
2.5.5
|
||||
|
@ -132,6 +132,9 @@ Patch34: perl-5.25.2-uninit-warning-from-h-const-coredumped.patch
|
||||
# Fix precedence in hv_ename_delete, RT#128086, in upstream after 5.25.0
|
||||
Patch35: perl-5.25.0-Fix-precedence-in-hv_ename_delete.patch
|
||||
|
||||
# Do not treat %: as a stash, RT#128238, in upstream after 5.25.2
|
||||
Patch36: perl-5.25.2-only-treat-stash-entries-with-.-as-sub-stashes.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
|
||||
|
||||
@ -2786,6 +2789,7 @@ Perl extension for Version Objects
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
%patch36 -p1
|
||||
%patch200 -p1
|
||||
%patch201 -p1
|
||||
|
||||
@ -2812,6 +2816,7 @@ perl -x patchlevel.h \
|
||||
'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 Patch35: Fix precedence in hv_ename_delete (RT#128086)' \
|
||||
'Fedora Patch36: Do not treat %: as a stash (RT#128238)' \
|
||||
'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}
|
||||
@ -5081,6 +5086,7 @@ popd
|
||||
* Wed Jun 22 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-368
|
||||
- Do not use unitialized memory in $h{\const} warnings (RT#128189)
|
||||
- Fix precedence in hv_ename_delete (RT#128086)
|
||||
- Do not treat %: as a stash (RT#128238)
|
||||
|
||||
* Mon Jun 20 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-367
|
||||
- Fix compiling regular expressions like /\X*(?0)/ (RT#128109)
|
||||
|
Loading…
Reference in New Issue
Block a user