This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make the original versions of relocated paths available from
[perl5.git] / hv.c
diff --git a/hv.c b/hv.c
index 0923f90..1f9cd29 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1943,7 +1943,7 @@ Perl_hv_eiter_set(pTHX_ HV *hv, HE *eiter) {
 }
 
 void
-Perl_hv_name_set(pTHX_ HV *hv, const char *name, I32 len, int flags)
+Perl_hv_name_set(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
 {
     dVAR;
     struct xpvhv_aux *iter;
@@ -1951,6 +1951,9 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, I32 len, int flags)
 
     PERL_UNUSED_ARG(flags);
 
+    if (len > I32_MAX)
+       Perl_croak(aTHX_ "panic: hv name too long (%"UVuf")", (UV) len);
+
     if (SvOOK(hv)) {
        iter = HvAUX(hv);
        if (iter->xhv_name) {
@@ -2062,7 +2065,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 flags)
        magic_nextpack((SV*) hv,mg,key);
        if (SvOK(key)) {
            /* force key to stay around until next time */
-           HeSVKEY_set(entry, SvREFCNT_inc(key));
+           HeSVKEY_set(entry, SvREFCNT_inc_simple_NN(key));
            return entry;               /* beware, hent_val is not set */
        }
        if (HeVAL(entry))