diff options
author | Björn Gustavsson <[email protected]> | 2017-11-30 11:56:50 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-11-30 11:56:50 +0100 |
commit | 3b3a617453af3ea5a731516585888c2373825a1d (patch) | |
tree | 02cbf85a6597461a8626adbfd5a4fc7d574738ba /erts/emulator/beam/atom.h | |
parent | 79f7815238673bbeea2b4551cc207768c348e5ce (diff) | |
parent | 864362749246d15355e904cf95248a634eebdfb7 (diff) | |
download | otp-3b3a617453af3ea5a731516585888c2373825a1d.tar.gz otp-3b3a617453af3ea5a731516585888c2373825a1d.tar.bz2 otp-3b3a617453af3ea5a731516585888c2373825a1d.zip |
Merge pull request #1633 from sunboshan/atom-size-fix
Fix integer overflow when set a large maximum value for atom table
OTP-14796
Diffstat (limited to 'erts/emulator/beam/atom.h')
-rw-r--r-- | erts/emulator/beam/atom.h | 2 |
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 |