aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bif_binary.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-08-14 09:44:29 +0200
committerLukas Larsson <[email protected]>2014-08-14 09:44:29 +0200
commit9de7cc7f881b5df18d0a26f7d37af164bc0c390e (patch)
treeb72c97468a188307915f707f0d2133f719719f0d /erts/emulator/beam/erl_bif_binary.c
parent8fe6c462ec8e20ab2ad14b0c1addf1030ada0e54 (diff)
parent9d3c22934491afe85fbcf8543ae43fb2eb1ab387 (diff)
downloadotp-9de7cc7f881b5df18d0a26f7d37af164bc0c390e.tar.gz
otp-9de7cc7f881b5df18d0a26f7d37af164bc0c390e.tar.bz2
otp-9de7cc7f881b5df18d0a26f7d37af164bc0c390e.zip
Merge branch 'lukas/erts/fix_neg_of_int64_min/OTP-12097' into maint
* lukas/erts/fix_neg_of_int64_min/OTP-12097: erts: Fix neg int overflow when sint is min size
Diffstat (limited to 'erts/emulator/beam/erl_bif_binary.c')
-rw-r--r--erts/emulator/beam/erl_bif_binary.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/erts/emulator/beam/erl_bif_binary.c b/erts/emulator/beam/erl_bif_binary.c
index 7e0e825a0d..3bf78adce7 100644
--- a/erts/emulator/beam/erl_bif_binary.c
+++ b/erts/emulator/beam/erl_bif_binary.c
@@ -1324,9 +1324,9 @@ static int parse_match_opts_list(Eterm l, Eterm bin, Uint *posp, Uint *endp)
goto badarg;
}
if (len < 0) {
- Sint lentmp = -len;
+ Uint lentmp = -(Uint)len;
/* overflow */
- if (lentmp == len || lentmp < 0 || -lentmp != len) {
+ if ((Sint)lentmp < 0) {
goto badarg;
}
len = lentmp;
@@ -1555,9 +1555,9 @@ BIF_RETTYPE erts_binary_part(Process *p, Eterm binary, Eterm epos, Eterm elen)
goto badarg;
}
if (len < 0) {
- Sint lentmp = -len;
+ Uint lentmp = -(Uint)len;
/* overflow */
- if (lentmp == len || lentmp < 0 || -lentmp != len) {
+ if ((Sint)lentmp < 0) {
goto badarg;
}
len = lentmp;
@@ -1644,9 +1644,9 @@ BIF_RETTYPE erts_gc_binary_part(Process *p, Eterm *reg, Eterm live, int range_is
goto badarg;
}
if (len < 0) {
- Sint lentmp = -len;
+ Uint lentmp = -(Uint)len;
/* overflow */
- if (lentmp == len || lentmp < 0 || -lentmp != len) {
+ if ((Sint)lentmp < 0) {
goto badarg;
}
len = lentmp;
@@ -2213,9 +2213,9 @@ static BIF_RETTYPE binary_bin_to_list_common(Process *p,
goto badarg;
}
if (len < 0) {
- Sint lentmp = -len;
+ Uint lentmp = -(Uint)len;
/* overflow */
- if (lentmp == len || lentmp < 0 || -lentmp != len) {
+ if ((Sint)lentmp < 0) {
goto badarg;
}
len = lentmp;