diff options
author | Yves Orton <demerphq@gmail.com> | 2022-03-05 07:18:11 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2022-03-06 16:16:56 +0000 |
commit | 96fcd8bed7d5ff5132bf47ab9d76c2ba5cda082a (patch) | |
tree | fa230ac1328031569690256566bcd13552cf276e | |
parent | 7c99e246fa01e58f96058e41774c81e4156ba087 (diff) | |
download | perl-96fcd8bed7d5ff5132bf47ab9d76c2ba5cda082a.tar.gz |
hv.c: ALWAYS perform in_collision check
This is a critical patch. Any perl built with the previous code
without PERL_HASH_RANDOMIZE_KEYS would never perform a key split!
(cherry picked from commit a977878db2027d6364aa362df635af0ad90f1b98)
-rw-r--r-- | hv.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -840,6 +840,7 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, else /* gotta do the real thing */ HeKEY_hek(entry) = save_hek_flags(key, klen, hash, flags); HeVAL(entry) = val; + in_collision = cBOOL(*oentry != NULL); #ifdef PERL_HASH_RANDOMIZE_KEYS /* This logic semi-randomizes the insert order in a bucket. @@ -847,7 +848,6 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, * making it harder to see if there is a collision. We also * reset the iterator randomizer if there is one. */ - in_collision = *oentry != NULL; if ( *oentry && PL_HASH_RAND_BITS_ENABLED) { PL_hash_rand_bits++; PL_hash_rand_bits= ROTL_UV(PL_hash_rand_bits,1); |