assert that what is passed into the hash functions is really an HV.
Nicholas Clark [Thu, 20 Sep 2007 10:20:47 +0000 (10:20 +0000)]
(MRO code is calling hash functions during global destruction, hence
the check on SVTYPEMASK.)

p4raw-id: //depot/perl@31922

hv.c

diff --git a/hv.c b/hv.c
index f1b3c90..a8c4875 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -422,6 +422,10 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
 
     if (!hv)
        return NULL;
+    if (SvTYPE(hv) == SVTYPEMASK)
+       return NULL;
+
+    assert(SvTYPE(hv) == SVt_PVHV);
 
     if (SvSMAGICAL(hv) && SvGMAGICAL(hv) && !(action & HV_DISABLE_UVAR_XKEY)) {
        MAGIC* mg;