aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bif_port.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/erl_bif_port.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/erl_bif_port.c')
-rw-r--r--erts/emulator/beam/erl_bif_port.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_bif_port.c b/erts/emulator/beam/erl_bif_port.c
index 839abd0424..3acc1d7bbd 100644
--- a/erts/emulator/beam/erl_bif_port.c
+++ b/erts/emulator/beam/erl_bif_port.c
@@ -649,7 +649,7 @@ BIF_RETTYPE port_get_data_1(BIF_ALIST_1)
static Port *
open_port(Process* p, Eterm name, Eterm settings, int *err_typep, int *err_nump)
{
- int i;
+ Sint i;
Eterm option;
Uint arity;
Eterm* tp;
@@ -977,8 +977,8 @@ static char **convert_args(Eterm l)
{
char **pp;
char *b;
- int n;
- int i = 0;
+ Sint n;
+ Sint i = 0;
Eterm str;
if (is_not_list(l) && is_not_nil(l)) {
return NULL;
@@ -1024,7 +1024,7 @@ static byte* convert_environment(Process* p, Eterm env)
Eterm* temp_heap;
Eterm* hp;
Uint heap_size;
- int n;
+ Sint n;
Sint size;
byte* bytes;
int encoding = erts_get_native_filename_encoding();