diff options
author | John Högberg <[email protected]> | 2019-01-10 10:02:16 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-01-10 10:02:16 +0100 |
commit | cb9993b93175edca260d0a470816a300c1320f6c (patch) | |
tree | 55be714e3337e34630202637f62832be01f101e0 | |
parent | f3d7370784de6ca5296ff627a53ada62bd128afb (diff) | |
parent | ac682f0d6128460164bc1656d8a7eab37d7d1058 (diff) | |
download | otp-cb9993b93175edca260d0a470816a300c1320f6c.tar.gz otp-cb9993b93175edca260d0a470816a300c1320f6c.tar.bz2 otp-cb9993b93175edca260d0a470816a300c1320f6c.zip |
Merge branch 'maint'
* maint:
Fix passing large integers as base to integer_to_X/2
-rw-r--r-- | erts/emulator/beam/bif.c | 6 | ||||
-rw-r--r-- | erts/emulator/beam/binary.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 37cd2083ea..492b0aac7b 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -2888,13 +2888,13 @@ BIF_RETTYPE integer_to_list_1(BIF_ALIST_1) BIF_RETTYPE integer_to_list_2(BIF_ALIST_2) { Eterm res; - int base; + SWord base; - if (is_not_integer(BIF_ARG_1) || is_not_integer(BIF_ARG_2)) { + if (is_not_integer(BIF_ARG_1) || is_not_small(BIF_ARG_2)) { BIF_ERROR(BIF_P, BADARG); } - base = unsigned_val(BIF_ARG_2); + base = signed_val(BIF_ARG_2); if (base < 2 || base > 36) { BIF_ERROR(BIF_P, BADARG); } diff --git a/erts/emulator/beam/binary.c b/erts/emulator/beam/binary.c index 5f090e89d7..a18228b84a 100644 --- a/erts/emulator/beam/binary.c +++ b/erts/emulator/beam/binary.c @@ -390,13 +390,13 @@ BIF_RETTYPE integer_to_binary_1(BIF_ALIST_1) BIF_RETTYPE integer_to_binary_2(BIF_ALIST_2) { Eterm res; - int base; + SWord base; - if (is_not_integer(BIF_ARG_1) || is_not_integer(BIF_ARG_2)) { + if (is_not_integer(BIF_ARG_1) || is_not_small(BIF_ARG_2)) { BIF_ERROR(BIF_P, BADARG); } - base = unsigned_val(BIF_ARG_2); + base = signed_val(BIF_ARG_2); if (base < 2 || base > 36) { BIF_ERROR(BIF_P, BADARG); } |