Change 19652 by [EMAIL PROTECTED] on 2003/05/31 19:54:31

        Fix a case of segfault in gv_check(), by making
        it ignore non-GV values in stashes.

Affected files ...

... //depot/perl/gv.c#189 edit
... //depot/perl/t/op/stash.t#2 edit

Differences ...

==== //depot/perl/gv.c#189 (text) ====
Index: perl/gv.c
--- perl/gv.c#188~19505~        Mon May 12 14:49:21 2003
+++ perl/gv.c   Sat May 31 12:54:31 2003
@@ -1156,7 +1156,7 @@
     for (i = 0; i <= (I32) HvMAX(stash); i++) {
        for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
            if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
-               (gv = (GV*)HeVAL(entry)) && (hv = GvHV(gv)))
+               (gv = (GV*)HeVAL(entry)) && isGV(gv) && (hv = GvHV(gv)))
            {
                if (hv != PL_defstash && hv != stash)
                     gv_check(hv);              /* nested package */

==== //depot/perl/t/op/stash.t#2 (text) ====
Index: perl/t/op/stash.t
--- perl/t/op/stash.t#1~17695~  Thu Aug  8 07:40:41 2002
+++ perl/t/op/stash.t   Sat May 31 12:54:31 2003
@@ -7,7 +7,7 @@
 
 require "./test.pl";
 
-plan( tests => 1 );
+plan( tests => 2 );
 
 # Used to segfault (bug #15479)
 fresh_perl_is(
@@ -15,4 +15,12 @@
     'Odd number of elements in hash assignment at - line 1.',
     { switches => [ '-w' ] },
     'delete $::{STDERR} and print a warning',
+);
+
+# Used to segfault
+fresh_perl_is(
+    'BEGIN { $::{"X::"} = 2 }',
+    '',
+    { switches => [ '-w' ] },
+    q(Insert a non-GV in a stash, under warnings 'once'),
 );
End of Patch.

Reply via email to