aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-01-10 10:02:06 +0100
committerJohn Högberg <[email protected]>2019-01-10 10:02:06 +0100
commitac682f0d6128460164bc1656d8a7eab37d7d1058 (patch)
treef6f425d0ec940a29ee6826fbd7f1a4d7ec1e491a
parent78e67434b34813b8efe61f8e8dca445dd12b0f7b (diff)
parented442259a6a914cc3778d902a38d27fdfb87bb3b (diff)
downloadotp-ac682f0d6128460164bc1656d8a7eab37d7d1058.tar.gz
otp-ac682f0d6128460164bc1656d8a7eab37d7d1058.tar.bz2
otp-ac682f0d6128460164bc1656d8a7eab37d7d1058.zip
Merge branch 'john/erts/fix-brainfart-in-integer_to_list_2' into maint
* john/erts/fix-brainfart-in-integer_to_list_2: Fix passing large integers as base to integer_to_X/2
-rw-r--r--erts/emulator/beam/bif.c6
-rw-r--r--erts/emulator/beam/binary.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index f1fac7f8d0..457910f913 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -2886,13 +2886,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);
}