Blame SOURCES/perl-5.25.2-perl-128238-Crash-with-non-stash-in-stash.patch

276c98
From 9e5cda6b852ca831004628051cf32c1576146452 Mon Sep 17 00:00:00 2001
276c98
From: Father Chrysostomos <sprout@cpan.org>
276c98
Date: Thu, 23 Jun 2016 21:57:09 -0700
276c98
Subject: [PATCH] [perl #128238] Crash with non-stash in stash
276c98
MIME-Version: 1.0
276c98
Content-Type: text/plain; charset=UTF-8
276c98
Content-Transfer-Encoding: 8bit
276c98
276c98
This is a follow-up to e7acdfe976f.  Even if the name of the stash
276c98
entry ends with ::, it may not itself contain a real stash (though
276c98
this only happens with code that assigns directly to stash entries,
276c98
which has undefined behaviour according to perlmod), so skip hashes
276c98
that are not stashes.
276c98
276c98
Signed-off-by: Petr Písař <ppisar@redhat.com>
276c98
---
276c98
 gv.c         |  4 ++--
276c98
 t/op/stash.t | 11 +++++++++--
276c98
 2 files changed, 11 insertions(+), 4 deletions(-)
276c98
276c98
diff --git a/gv.c b/gv.c
276c98
index 2b3bdfa..dff611e 100644
276c98
--- a/gv.c
276c98
+++ b/gv.c
276c98
@@ -2411,10 +2411,10 @@ Perl_gv_check(pTHX_ HV *stash)
276c98
 
276c98
     PERL_ARGS_ASSERT_GV_CHECK;
276c98
 
276c98
-    if (!HvARRAY(stash))
276c98
+    if (!SvOOK(stash))
276c98
 	return;
276c98
 
276c98
-    assert(SvOOK(stash));
276c98
+    assert(HvARRAY(stash));
276c98
 
276c98
     for (i = 0; i <= (I32) HvMAX(stash); i++) {
276c98
         const HE *entry;
276c98
diff --git a/t/op/stash.t b/t/op/stash.t
276c98
index 1591dbf..fe42700 100644
276c98
--- a/t/op/stash.t
276c98
+++ b/t/op/stash.t
276c98
@@ -7,7 +7,7 @@ BEGIN {
276c98
 
276c98
 BEGIN { require "./test.pl"; }
276c98
 
276c98
-plan( tests => 53 );
276c98
+plan( tests => 54 );
276c98
 
276c98
 # Used to segfault (bug #15479)
276c98
 fresh_perl_like(
276c98
@@ -342,4 +342,11 @@ is runperl(
276c98
     stderr => 1,
276c98
    ),
276c98
    "ok\n",
276c98
-   "[perl #128238] don't treat %: as a stash (needs 2 colons)"
276c98
+   "[perl #128238] don't treat %: as a stash (needs 2 colons)";
276c98
+
276c98
+is runperl(
276c98
+    prog => 'BEGIN { $::{q|foo::|}=*ENV; $^W=1}; print qq|ok\n|',
276c98
+    stderr => 1,
276c98
+   ),
276c98
+   "ok\n",
276c98
+   "[perl #128238] non-stashes in stashes";
276c98
-- 
276c98
2.5.5
276c98