aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-11-13 19:13:03 +0100
committerSverker Eriksson <[email protected]>2015-11-13 19:13:20 +0100
commitfd1e6b2b2623395512ea0450c3b4e656cb354f42 (patch)
tree91adb925cfd7482af576127e4847d12f9d138971 /erts/emulator
parent76c67f6ab6b33033e1efb1b1fd190be163c99ef4 (diff)
downloadotp-fd1e6b2b2623395512ea0450c3b4e656cb354f42.tar.gz
otp-fd1e6b2b2623395512ea0450c3b4e656cb354f42.tar.bz2
otp-fd1e6b2b2623395512ea0450c3b4e656cb354f42.zip
stdlib: Fix bug in binary:split for empty binary
Bug introduced om master branch at b93e9b611056828a and reported in ERL-43.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/erl_bif_binary.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_bif_binary.c b/erts/emulator/beam/erl_bif_binary.c
index b9640e211d..aec72bd61a 100644
--- a/erts/emulator/beam/erl_bif_binary.c
+++ b/erts/emulator/beam/erl_bif_binary.c
@@ -1614,6 +1614,10 @@ static Eterm do_split_not_found_result(Process *p, Eterm subject, BinaryFindStat
Eterm *hp;
Eterm ret;
+ if (bfs->flags & (BINARY_SPLIT_TRIM | BINARY_SPLIT_TRIM_ALL)
+ && binary_size(subject) == 0) {
+ return NIL;
+ }
hp = HAlloc(p, 2);
ret = CONS(hp, subject, NIL);