aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_utils.h
diff options
context:
space:
mode:
authorKjell Winblad <[email protected]>2019-03-28 15:46:04 +0100
committerKjell Winblad <[email protected]>2019-03-29 15:54:36 +0100
commit3640c4ed502a93fc11480e48cc817e28dfe831e4 (patch)
tree432ce566020bea51893ef398c542ce3a7396b326 /erts/emulator/beam/erl_utils.h
parent060d9110ffb305d6ce5f974788948463e481203b (diff)
downloadotp-3640c4ed502a93fc11480e48cc817e28dfe831e4.tar.gz
otp-3640c4ed502a93fc11480e48cc817e28dfe831e4.tar.bz2
otp-3640c4ed502a93fc11480e48cc817e28dfe831e4.zip
Fix out of memory bug in the implementation of maps
This commit fixes a bug that could cause a crash or memory usage to grow until the machine ran out of memory when adding a key-value pair to a map. This could happen when inserting a new key-value pair with a key K1 containing a binary B1 into a map M having a key K2 with a binary B2 if the following conditions were met: * size(B1) >= 4294967296 * size(B2) >= 4294967296 * size(M) >= 32 * (size(B1) rem 4294967296) == (size(B2) rem 4294967296) * the first (size(B1) rem 4294967296) bytes are the same both in B1 and B2 * substituting B1 in K1 with B2 would result in a term with the same value as K2 The root cause of the bug is that the map implementation only hashed the first (X modulo 4294967296) bytes of binaries so that different binaries could get hashed to the same hash value independently of the hash seed.
Diffstat (limited to 'erts/emulator/beam/erl_utils.h')
-rw-r--r--erts/emulator/beam/erl_utils.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_utils.h b/erts/emulator/beam/erl_utils.h
index 880febba8b..430ac305c5 100644
--- a/erts/emulator/beam/erl_utils.h
+++ b/erts/emulator/beam/erl_utils.h
@@ -69,7 +69,6 @@ int erts_fit_in_bits_int32(Sint32);
int erts_fit_in_bits_uint(Uint);
Sint erts_list_length(Eterm);
int erts_is_builtin(Eterm, Eterm, int);
-Uint32 block_hash(byte *, unsigned, Uint32);
Uint32 make_hash2(Eterm);
Uint32 make_hash(Eterm);
Uint32 make_internal_hash(Eterm, Uint32 salt);