aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-03-12 12:31:43 +0100
committerJohn Högberg <[email protected]>2018-03-12 12:31:43 +0100
commita0fc09d828a34a51e194f898399673b521f69463 (patch)
tree3d8f99714a6f0e2a380a3119092be9f9fbf9ecc8 /erts
parent2960c7d08932b718dc93773e0718cd214277e09d (diff)
parent5f780125c1d2c625c799df7e5e0816d99b17f590 (diff)
downloadotp-a0fc09d828a34a51e194f898399673b521f69463.tar.gz
otp-a0fc09d828a34a51e194f898399673b521f69463.tar.bz2
otp-a0fc09d828a34a51e194f898399673b521f69463.zip
Merge branch 'john/erts/tuple-arityval-fixes/OTP-14963/ERL-577'
* john/erts/tuple-arityval-fixes/OTP-14963/ERL-577: Make doc entry for maximum tuple size reflect reality Assert that sz <= MAX_ARITYVAL in make_arityval(sz)
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/bif.c2
-rw-r--r--erts/emulator/beam/erl_term.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 5a98cb827c..652b95105f 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -3101,7 +3101,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 7d42d1b396..3dd1c2555c 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -313,7 +313,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))