From: Rafael Garcia-Suarez Date: Sat, 31 May 2003 19:54:31 +0000 (+0000) Subject: Fix a case of segfault in gv_check(), by making X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b862623f640d051afa35dfa66f03e9a997880b50;p=p5sagit%2Fp5-mst-13.2.git Fix a case of segfault in gv_check(), by making it ignore non-GV values in stashes. p4raw-id: //depot/perl@19652 --- diff --git a/gv.c b/gv.c index 95d4d36..41feaa2 100644 --- a/gv.c +++ b/gv.c @@ -1156,7 +1156,7 @@ Perl_gv_check(pTHX_ HV *stash) 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 */ diff --git a/t/op/stash.t b/t/op/stash.t index c8fe0ae..0cd7ebf 100644 --- a/t/op/stash.t +++ b/t/op/stash.t @@ -7,7 +7,7 @@ BEGIN { require "./test.pl"; -plan( tests => 1 ); +plan( tests => 2 ); # Used to segfault (bug #15479) fresh_perl_is( @@ -16,3 +16,11 @@ fresh_perl_is( { 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'), +);