diff options
author | Richard Carlsson <[email protected]> | 2015-12-03 14:33:53 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-02-08 16:11:56 +0100 |
commit | 14680fcc3fb9d0357fe33a94525d08896afed1c5 (patch) | |
tree | 40b1891cdbe478154d62262616494dbc27eabcf1 /erts/emulator/beam/erl_bif_lists.c | |
parent | acc4ac9f421e064bc0e573a9d5ecd26afe7cb8d6 (diff) | |
download | otp-14680fcc3fb9d0357fe33a94525d08896afed1c5.tar.gz otp-14680fcc3fb9d0357fe33a94525d08896afed1c5.tar.bz2 otp-14680fcc3fb9d0357fe33a94525d08896afed1c5.zip |
erts: Use Sint instead of int for list lengths
This avoids potential integer arithmetic overflow for very large lists.
Diffstat (limited to 'erts/emulator/beam/erl_bif_lists.c')
-rw-r--r-- | erts/emulator/beam/erl_bif_lists.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_bif_lists.c b/erts/emulator/beam/erl_bif_lists.c index 5583dcb371..fe64e76575 100644 --- a/erts/emulator/beam/erl_bif_lists.c +++ b/erts/emulator/beam/erl_bif_lists.c @@ -42,7 +42,7 @@ static BIF_RETTYPE append(Process* p, Eterm A, Eterm B) Eterm last; size_t need; Eterm* hp; - int i; + Sint i; if ((i = erts_list_length(A)) < 0) { BIF_ERROR(p, BADARG); @@ -99,9 +99,9 @@ static Eterm subtract(Process* p, Eterm A, Eterm B) Eterm small_vec[SMALL_VEC_SIZE]; /* Preallocated memory for small lists */ Eterm* vec_p; Eterm* vp; - int i; - int n; - int m; + Sint i; + Sint n; + Sint m; if ((n = erts_list_length(A)) < 0) { BIF_ERROR(p, BADARG); |