diff options
author | Boshan Sun <[email protected]> | 2017-11-20 10:41:48 -0800 |
---|---|---|
committer | Boshan Sun <[email protected]> | 2017-11-20 10:41:48 -0800 |
commit | 864362749246d15355e904cf95248a634eebdfb7 (patch) | |
tree | dd95c4e0be29c63ebb43a9f1e98d405fe7d16eb8 /erts/emulator/beam/erl_nif.h | |
parent | 23e511d470e6795799c29b5ccb2ab6a17589e543 (diff) | |
download | otp-864362749246d15355e904cf95248a634eebdfb7.tar.gz otp-864362749246d15355e904cf95248a634eebdfb7.tar.bz2 otp-864362749246d15355e904cf95248a634eebdfb7.zip |
Fix max atom size overflow on 64-bits Erlang by lowering the
MAX_ATOM_TABLE_SIZE
Currently, the max atom size on 64-bits Erlang is
((UWORD_CONSTANT(1) << 32) = 4294967296
This number will cause the range of atom size to be displayed as
[8192-0].
Also, the +t option for max atom size will be parsed as a long type, and
assigned to a int variable erts_atom_table_size (erl_init.c),
which will cause integer overflow if the number is larger than the
maximum value a 4-bytes signed integer can hold
((1 << 31) - 1) = 2147483647
Therefore, during the comparison
erts_atom_table_size < MIN_ATOM_TABLE_SIZE
any number above 2147483647 will be come negative, and causing
the condition to be true, which then errored out as bad atom table size.
Hence, the actual max atom size is same as the max signed int value.
Diffstat (limited to 'erts/emulator/beam/erl_nif.h')
0 files changed, 0 insertions, 0 deletions