aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/binary.c
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-02-15 17:06:36 +0100
committerJohn Högberg <[email protected]>2018-02-15 17:10:31 +0100
commit443fbb24248516523512c9bc591252eafafd1311 (patch)
tree9a42d84f7f85749d5afba867bb63bdbbc5d8651f /erts/emulator/beam/binary.c
parentca603d7ba3e537670331754539430c704779d5ea (diff)
downloadotp-443fbb24248516523512c9bc591252eafafd1311.tar.gz
otp-443fbb24248516523512c9bc591252eafafd1311.tar.bz2
otp-443fbb24248516523512c9bc591252eafafd1311.zip
badarg on iolist_to_binary(Bitstring)
When supplied without an enclosing list, bitstrings were returned as-is instead of badarging.
Diffstat (limited to 'erts/emulator/beam/binary.c')
-rw-r--r--erts/emulator/beam/binary.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/beam/binary.c b/erts/emulator/beam/binary.c
index ca3e48e205..cf7dcb13d5 100644
--- a/erts/emulator/beam/binary.c
+++ b/erts/emulator/beam/binary.c
@@ -964,7 +964,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]);
}