summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-02-27 11:44:12 +0000
committerDavid Mitchell <davem@iabyn.com>2017-02-27 11:44:12 +0000
commit78e4f28fec5bf0c2d3d8edbbd73ac68db3308f05 (patch)
tree8df77b3caed5837f27d409d79e6b20fbf0b40f2b /gv.c
parentaa9ac6cf00899a6f55881d4ca6c1214215dc83ee (diff)
downloadperl-78e4f28fec5bf0c2d3d8edbbd73ac68db3308f05.tar.gz
S_gv_stashsvpvn_cached(): add asserts
RT #130344 PL_stashcache holds SvIOK() scalars whose integer values are hidden pointers to HVs. Add asserts that this is indeed the case.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index 8c85614386..d32a9c5399 100644
--- a/gv.c
+++ b/gv.c
@@ -1496,7 +1496,14 @@ S_gv_stashsvpvn_cached(pTHX_ SV *namesv, const char *name, U32 namelen, I32 flag
(flags & SVf_UTF8) ? HVhek_UTF8 : 0, 0, NULL, 0
);
- if (he) return INT2PTR(HV*,SvIVX(HeVAL(he)));
+ if (he) {
+ SV *sv = HeVAL(he);
+ HV *hv;
+ assert(SvIOK(sv));
+ hv = INT2PTR(HV*, SvIVX(sv));
+ assert(SvTYPE(hv) == SVt_PVHV);
+ return hv;
+ }
else if (flags & GV_CACHE_ONLY) return NULL;
if (namesv) {