diff options
author | John Högberg <[email protected]> | 2018-03-05 14:03:29 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-03-05 14:10:07 +0100 |
commit | a091bcc99dd1c8ab5dc5e5f5e80ef254383170f4 (patch) | |
tree | 21b51bf4f9171ee9cb1d16f81df3b267a68d6e64 /erts | |
parent | 7ac3e7857f49b231ada6517e6a2c92f302d54e0c (diff) | |
download | otp-a091bcc99dd1c8ab5dc5e5f5e80ef254383170f4.tar.gz otp-a091bcc99dd1c8ab5dc5e5f5e80ef254383170f4.tar.bz2 otp-a091bcc99dd1c8ab5dc5e5f5e80ef254383170f4.zip |
Assert that sz <= MAX_ARITYVAL in make_arityval(sz)
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/bif.c | 2 | ||||
-rw-r--r-- | erts/emulator/beam/erl_term.h | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index d7a25adccb..92d49a6def 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -3171,7 +3171,7 @@ BIF_RETTYPE list_to_integer_2(BIF_ALIST_2) static int do_float_to_charbuf(Process *p, Eterm efloat, Eterm list, char *fbuf, int sizeof_fbuf) { - const static int arity_two = make_arityval(2); + Eterm arity_two = make_arityval(2); int decimals = SYS_DEFAULT_FLOAT_DECIMALS; int compact = 0; enum fmt_type_ { diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h index 842802f8d9..b263be0738 100644 --- a/erts/emulator/beam/erl_term.h +++ b/erts/emulator/beam/erl_term.h @@ -317,7 +317,8 @@ _ET_DECLARE_CHECKED(Uint,header_arity,Eterm) #define MAX_ARITYVAL ((((Uint)1) << 24) - 1) #define ERTS_MAX_TUPLE_SIZE MAX_ARITYVAL -#define make_arityval(sz) _make_header((sz),_TAG_HEADER_ARITYVAL) +#define make_arityval(sz) (ASSERT((sz) <= MAX_ARITYVAL), \ + _make_header((sz),_TAG_HEADER_ARITYVAL)) #define is_arity_value(x) (((x) & _TAG_HEADER_MASK) == _TAG_HEADER_ARITYVAL) #define is_sane_arity_value(x) ((((x) & _TAG_HEADER_MASK) == _TAG_HEADER_ARITYVAL) && \ (((x) >> _HEADER_ARITY_OFFS) <= MAX_ARITYVAL)) |