diff options
author | Kjell Winblad <[email protected]> | 2019-03-28 15:46:04 +0100 |
---|---|---|
committer | Kjell Winblad <[email protected]> | 2019-03-29 15:54:36 +0100 |
commit | 3640c4ed502a93fc11480e48cc817e28dfe831e4 (patch) | |
tree | 432ce566020bea51893ef398c542ce3a7396b326 /erts/prebuild.skip | |
parent | 060d9110ffb305d6ce5f974788948463e481203b (diff) | |
download | otp-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/prebuild.skip')
0 files changed, 0 insertions, 0 deletions