aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bif_load.c
diff options
context:
space:
mode:
authorRichard Carlsson <[email protected]>2015-12-03 14:33:53 +0100
committerSverker Eriksson <[email protected]>2016-02-08 16:11:56 +0100
commit14680fcc3fb9d0357fe33a94525d08896afed1c5 (patch)
tree40b1891cdbe478154d62262616494dbc27eabcf1 /erts/emulator/beam/beam_bif_load.c
parentacc4ac9f421e064bc0e573a9d5ecd26afe7cb8d6 (diff)
downloadotp-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/beam_bif_load.c')
-rw-r--r--erts/emulator/beam/beam_bif_load.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index a000935388..1b4c022370 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -179,8 +179,8 @@ exception_list(Process* p, Eterm tag, struct m* mp, Sint exceptions)
BIF_RETTYPE
finish_loading_1(BIF_ALIST_1)
{
- int i;
- int n;
+ Sint i;
+ Sint n;
struct m* p = NULL;
Uint exceptions;
Eterm res;
@@ -201,7 +201,7 @@ finish_loading_1(BIF_ALIST_1)
*/
n = erts_list_length(BIF_ARG_1);
- if (n == -1) {
+ if (n < 0) {
ERTS_BIF_PREP_ERROR(res, BIF_P, BADARG);
goto done;
}