From a977878db2027d6364aa362df635af0ad90f1b98 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Sat, 5 Mar 2022 07:18:11 +0100 Subject: 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! --- hv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hv.c') 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); -- cgit v1.2.1