aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/module.c
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/module.c
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/module.c')
0 files changed, 0 insertions, 0 deletions