This is a live mirror of the Perl 5 development currently hosted at
Change hv_name_set to take U32 length and flags parameters.
authorNicholas Clark <>
Sun, 5 Mar 2006 18:40:59 +0000 (18:40 +0000)
committerNicholas Clark <>
Sun, 5 Mar 2006 18:40:59 +0000 (18:40 +0000)
p4raw-id: //depot/perl@27381


index 6282514..4778e16 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1527,7 +1527,7 @@ ApoR      |I32*   |hv_riter_p     |NN HV* hv
 ApoR   |HE**   |hv_eiter_p     |NN HV* hv
 Apo    |void   |hv_riter_set   |NN HV* hv|I32 riter
 Apo    |void   |hv_eiter_set   |NN HV* hv|NULLOK HE* eiter
-Ap     |void   |hv_name_set    |NN HV* hv|NULLOK const char *name|I32 len|int flags
+Ap     |void   |hv_name_set    |NN HV* hv|NULLOK const char *name|U32 len|U32 flags
 poM    |AV**   |hv_backreferences_p    |NN HV* hv
 #if defined(PERL_IN_DUMP_C) || defined(PERL_IN_HV_C) || defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
 poM    |void   |hv_kill_backrefs       |NN HV* hv
diff --git a/hv.c b/hv.c
index 1a93d3c..1f9cd29 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1943,7 +1943,7 @@ Perl_hv_eiter_set(pTHX_ HV *hv, HE *eiter) {
-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)
     struct xpvhv_aux *iter;
@@ -1951,6 +1951,9 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, I32 len, int 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) {
diff --git a/proto.h b/proto.h
index 94718f2..c836e4a 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -4106,7 +4106,7 @@ PERL_CALLCONV void        Perl_hv_riter_set(pTHX_ HV* hv, I32 riter)
 PERL_CALLCONV void     Perl_hv_eiter_set(pTHX_ HV* hv, HE* eiter)
-PERL_CALLCONV void     Perl_hv_name_set(pTHX_ HV* hv, const char *name, I32 len, int flags)
+PERL_CALLCONV void     Perl_hv_name_set(pTHX_ HV* hv, const char *name, U32 len, U32 flags)
 PERL_CALLCONV AV**     Perl_hv_backreferences_p(pTHX_ HV* hv)