diff options
author | John Högberg <[email protected]> | 2018-02-19 15:36:40 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-02-19 15:36:40 +0100 |
commit | d19fc31cba8670c2fc09a7911b4e329052a3a23d (patch) | |
tree | 84fd21890a8786cc176db71a8c517e5a86107933 /erts/emulator/beam | |
parent | 474b2ef465cddf41d311464c48bf99dd007f270f (diff) | |
parent | 443fbb24248516523512c9bc591252eafafd1311 (diff) | |
download | otp-d19fc31cba8670c2fc09a7911b4e329052a3a23d.tar.gz otp-d19fc31cba8670c2fc09a7911b4e329052a3a23d.tar.bz2 otp-d19fc31cba8670c2fc09a7911b4e329052a3a23d.zip |
Merge branch 'john/erts/fix-iolist-bitstring-badarg/OTP-14926' into maint
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/binary.c | 5 | ||||
-rw-r--r-- | erts/emulator/beam/erl_io_queue.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/erts/emulator/beam/binary.c b/erts/emulator/beam/binary.c index d4db1a4188..95d324d2c1 100644 --- a/erts/emulator/beam/binary.c +++ b/erts/emulator/beam/binary.c @@ -953,7 +953,10 @@ HIPE_WRAPPER_BIF_DISABLE_GC(iolist_to_binary, 1) BIF_RETTYPE iolist_to_binary_1(BIF_ALIST_1) { if (is_binary(BIF_ARG_1)) { - BIF_RET(BIF_ARG_1); + if (binary_bitsize(BIF_ARG_1) == 0) { + BIF_RET(BIF_ARG_1); + } + BIF_ERROR(BIF_P, BADARG); } return erts_list_to_binary_bif(BIF_P, BIF_ARG_1, bif_export[BIF_iolist_to_binary_1]); } diff --git a/erts/emulator/beam/erl_io_queue.c b/erts/emulator/beam/erl_io_queue.c index 990c0c1cac..eb156cc578 100644 --- a/erts/emulator/beam/erl_io_queue.c +++ b/erts/emulator/beam/erl_io_queue.c @@ -1203,7 +1203,10 @@ BIF_RETTYPE iolist_to_iovec_1(BIF_ALIST_1) { if (is_nil(BIF_ARG_1)) { BIF_RET(NIL); } else if (is_binary(BIF_ARG_1)) { - if (binary_size(BIF_ARG_1) != 0) { + if (binary_bitsize(BIF_ARG_1) != 0) { + ASSERT(!(BIF_P->flags & F_DISABLE_GC)); + BIF_ERROR(BIF_P, BADARG); + } else if (binary_size(BIF_ARG_1) != 0) { Eterm *hp = HAlloc(BIF_P, 2); BIF_RET(CONS(hp, BIF_ARG_1, NIL)); |