diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-11-18 18:28:08 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-11-20 18:15:13 -0800 |
commit | 4c2bfb4f71321bcaebd7aa164447958a33081791 (patch) | |
tree | 63c8f53e79f45014e3bdc693b9fb36a6ba5b6504 /hv.c | |
parent | 3a5c91344a6e5968c082c1ed4c366b743bcba459 (diff) | |
download | perl-4c2bfb4f71321bcaebd7aa164447958a33081791.tar.gz |
Fix hv_name_set when there is an HvENAME
This code was completely wrong and could even crash. This is not cur-
rently reached.
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -2081,14 +2081,17 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, U32 len, U32 flags) iter->xhv_name_count = 0; } else { - spot = (HEK **)iter->xhv_name; if(iter->xhv_name_count > 0) { /* shift some things over */ - Renew(spot, iter->xhv_name_count, HEK *); - spot[iter->xhv_name_count++] = spot[1]; + Renewc( + iter->xhv_name, iter->xhv_name_count + 1, HEK *, HEK + ); + spot = (HEK **)iter->xhv_name; + spot[iter->xhv_name_count] = spot[1]; spot[1] = spot[0]; + iter->xhv_name_count = -(iter->xhv_name_count + 1); } - else if(*spot) { + else if(*(spot = (HEK **)iter->xhv_name)) { unshare_hek_or_pvn(*spot, 0, 0, 0); } } |