Reject hamt duplications in enif_make_map_from_arrays#10976
Reject hamt duplications in enif_make_map_from_arrays#10976nickva wants to merge 2 commits intoerlang:masterfrom
Conversation
CT Test Results 3 files 136 suites 50m 46s ⏱️ Results for commit a52bc0f. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
c84ab40 to
2dfc309
Compare
|
Thanks for the report and fix. I pushed a fixup that instead makes |
Previously `enif_make_map_from_arrays` did not reject duplicates for hamt maps (those with greater than 32 keys) as the API indicated. Intead, it would return a hamt map that might not match against a map built from the same key-value pairs in Erlang. It turns out that the internal hamt building call already takes a `reject_dupkeys` argument, it was just always set to 0, so to fix the issue, we thread the parameter through, so that `enif_make_map_from_arrays` when it constructs the hamt object, always sets `reject_dupkeys=1`. Fix erlang#10975 Co-authored-by: Sverker Eriksson <sverker@erlang.org>
into 'sverker/27/erts/fix-nif-map-from-array/OTP-20098'
|
Thank you, Sverker, that's a much better fix! |
a15f671 to
a52bc0f
Compare
|
I squashed our two commits and rebased it back onto |
Previously
enif_make_map_from_arraysdid not reject duplicates for hamt maps (those with greater than 32 keys) as the API indicated. Instead, it would return a hamt map that might not match against a map built from the same key-value pair set in Erlang.It turns out that the internal hamt building call already takes a
reject_dupkeysargument, it was just always set to 0, so to fix the issue we thread the parameter through, so thatenif_make_map_from_arrayswhen it constructs the hamt object, always setsreject_dupkeys=1.Fix #10975