aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_term.h
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-03-05 14:03:29 +0100
committerJohn Högberg <[email protected]>2018-03-05 14:10:07 +0100
commita091bcc99dd1c8ab5dc5e5f5e80ef254383170f4 (patch)
tree21b51bf4f9171ee9cb1d16f81df3b267a68d6e64 /erts/emulator/beam/erl_term.h
parent7ac3e7857f49b231ada6517e6a2c92f302d54e0c (diff)
downloadotp-a091bcc99dd1c8ab5dc5e5f5e80ef254383170f4.tar.gz
otp-a091bcc99dd1c8ab5dc5e5f5e80ef254383170f4.tar.bz2
otp-a091bcc99dd1c8ab5dc5e5f5e80ef254383170f4.zip
Assert that sz <= MAX_ARITYVAL in make_arityval(sz)
Diffstat (limited to 'erts/emulator/beam/erl_term.h')
-rw-r--r--erts/emulator/beam/erl_term.h3
1 files changed, 2 insertions, 1 deletions
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))