aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/atom.h
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-11-30 11:57:54 +0100
committerBjörn Gustavsson <[email protected]>2017-11-30 11:57:54 +0100
commit6fb6f4222f2cf924cbb9174d33c3b3190cfe52f2 (patch)
tree124498af9e9a04f37536cfcd8911ebe2e752a673 /erts/emulator/beam/atom.h
parentfadc3d671d2edcf15b87719f350451c32c1f4bbb (diff)
parent3b3a617453af3ea5a731516585888c2373825a1d (diff)
downloadotp-6fb6f4222f2cf924cbb9174d33c3b3190cfe52f2.tar.gz
otp-6fb6f4222f2cf924cbb9174d33c3b3190cfe52f2.tar.bz2
otp-6fb6f4222f2cf924cbb9174d33c3b3190cfe52f2.zip
Merge branch 'maint'
* maint: Fix max atom size overflow on 64-bits Erlang by lowering the MAX_ATOM_TABLE_SIZE Fix integer overflow when set a large maximum value for atom table
Diffstat (limited to 'erts/emulator/beam/atom.h')
-rw-r--r--erts/emulator/beam/atom.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/beam/atom.h b/erts/emulator/beam/atom.h
index be998a46bd..385120a8d9 100644
--- a/erts/emulator/beam/atom.h
+++ b/erts/emulator/beam/atom.h
@@ -36,7 +36,7 @@
/* Internal atom cache needs MAX_ATOM_TABLE_SIZE to be less than an
unsigned 32 bit integer. See external.c(erts_encode_ext_dist_header_setup)
for more details. */
-#define MAX_ATOM_TABLE_SIZE ((MAX_ATOM_INDEX + 1 < (UWORD_CONSTANT(1) << 32)) ? MAX_ATOM_INDEX + 1 : (UWORD_CONSTANT(1) << 32))
+#define MAX_ATOM_TABLE_SIZE ((MAX_ATOM_INDEX + 1 < (UWORD_CONSTANT(1) << 32)) ? MAX_ATOM_INDEX + 1 : ((UWORD_CONSTANT(1) << 31) - 1)) /* Here we use maximum signed interger value to avoid integer overflow */
#else
#define MAX_ATOM_TABLE_SIZE (MAX_ATOM_INDEX + 1)
#endif