summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-03-05 07:18:11 +0100
committerYves Orton <demerphq@gmail.com>2022-03-05 10:18:22 +0100
commita977878db2027d6364aa362df635af0ad90f1b98 (patch)
tree82d28c49a66e305585df8964b3cd03f7b9c84668 /hv.c
parent1bd2ffc2ed1dd21ac38de7e081c97ef241eebf5b (diff)
downloadperl-a977878db2027d6364aa362df635af0ad90f1b98.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!
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hv.c b/hv.c
index 34b722809d..c7894932f3 100644
--- a/hv.c
+++ b/hv.c
@@ -849,6 +849,7 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
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.
@@ -856,7 +857,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);