aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-04-07 12:58:15 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-04-07 13:09:20 +0200
commit30ed5b1cc6aa0efe6ac099b66d33d46c7c0c6b47 (patch)
tree31e1431e9085b01b536839c9076c089d7bc0ae77 /erts/emulator/test
parentcc722af4d62d749d2a75155e91a2a1562aeb2a5a (diff)
downloadotp-30ed5b1cc6aa0efe6ac099b66d33d46c7c0c6b47.tar.gz
otp-30ed5b1cc6aa0efe6ac099b66d33d46c7c0c6b47.tar.bz2
otp-30ed5b1cc6aa0efe6ac099b66d33d46c7c0c6b47.zip
erts: Fix deep colliding hash values in maps:from_list/1
Reported-by: Jesper Louis Andersen
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/map_SUITE.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/erts/emulator/test/map_SUITE.erl b/erts/emulator/test/map_SUITE.erl
index dc6286fdb6..f061b177c5 100644
--- a/erts/emulator/test/map_SUITE.erl
+++ b/erts/emulator/test/map_SUITE.erl
@@ -1888,11 +1888,19 @@ t_bif_map_merge(Config) when is_list(Config) ->
M8 = maps:merge(M7,M8),
M8 = maps:merge(M8,M8),
+ %% maps:merge/2 and mixed
+
+ Ks1 = [764492191,2361333849], %% deep collision
+ Ks2 = lists:seq(1,33),
+ M9 = maps:from_list([{K,K}||K <- Ks1]),
+ M10 = maps:from_list([{K,K}||K <- Ks2]),
+ M11 = maps:merge(M9,M10),
+ ok = check_keys_exist(Ks1 ++ Ks2, M11),
+
%% error case
{'EXIT',{badarg,[{maps,merge,_,_}|_]}} = (catch maps:merge((1 bsl 65 + 3), <<>>)),
{'EXIT',{badarg,[{maps,merge,_,_}|_]}} = (catch maps:merge(<<>>, id(#{ a => 1}))),
{'EXIT',{badarg,[{maps,merge,_,_}|_]}} = (catch maps:merge(id(#{ a => 2}), <<>> )),
-
ok.