aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_term.h
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-12-12 15:29:08 +0100
committerBjörn-Egil Dahlberg <[email protected]>2012-12-12 15:29:08 +0100
commit079411c887aa0971215ccb366fb83d7e56ec7777 (patch)
tree6e6a174d6fc6866c36c2c4a9d7c6f73fb83aba75 /erts/emulator/beam/erl_term.h
parent17532edb1301f52c1dbc37955a527bb1da333b4d (diff)
parent9c3451fdca9598772572f59bb594245e1c78137e (diff)
downloadotp-079411c887aa0971215ccb366fb83d7e56ec7777.tar.gz
otp-079411c887aa0971215ccb366fb83d7e56ec7777.tar.bz2
otp-079411c887aa0971215ccb366fb83d7e56ec7777.zip
Merge branch 'egil/enforce-tuple-specification-size/OTP-10633'
* egil/enforce-tuple-specification-size/OTP-10633: erts: Use memcpy instead of while in setelement/3 test: Refactor away ?line macro in tuple_SUITE erts: Enforce tuple max size on BIFs erts: Define max tuple size to 24 bits
Diffstat (limited to 'erts/emulator/beam/erl_term.h')
-rw-r--r--erts/emulator/beam/erl_term.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h
index bc4c3a09a0..fb3ef9cd6c 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -300,8 +300,17 @@ _ET_DECLARE_CHECKED(Uint,header_arity,Eterm)
#define header_arity(x) _ET_APPLY(header_arity,(x))
/* arityval access methods */
+/* Erlang Spec. 4.7.3 defines max arity to 65535
+ * we will however enforce max arity of 16777215 (24 bits)
+ * (checked in bifs and asserted in debug)
+ */
+#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 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))
#define is_not_arity_value(x) (!is_arity_value((x)))
#define _unchecked_arityval(x) _unchecked_header_arity((x))
_ET_DECLARE_CHECKED(Uint,arityval,Eterm)