diff options
author | John Högberg <[email protected]> | 2018-02-15 16:34:04 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-02-15 16:59:12 +0100 |
commit | ca603d7ba3e537670331754539430c704779d5ea (patch) | |
tree | 8cf18141515526a5bad5885fde617de581ff63e9 /erts/emulator/beam | |
parent | 309ef748ddc5bde4bcba280ce2739385f27a76e6 (diff) | |
download | otp-ca603d7ba3e537670331754539430c704779d5ea.tar.gz otp-ca603d7ba3e537670331754539430c704779d5ea.tar.bz2 otp-ca603d7ba3e537670331754539430c704779d5ea.zip |
badarg on iolist_to_iovec(Bitstring)
When supplied without an enclosing list, bitstrings were silently
truncated to [] instead of badarging.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/erl_io_queue.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_io_queue.c b/erts/emulator/beam/erl_io_queue.c index 190ba6bbb9..945ee1b6b5 100644 --- a/erts/emulator/beam/erl_io_queue.c +++ b/erts/emulator/beam/erl_io_queue.c @@ -1188,7 +1188,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)); |