diff options
author | Björn-Egil Dahlberg <egil@erlang.org> | 2013-03-07 15:58:10 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <egil@erlang.org> | 2013-03-12 16:42:12 +0100 |
commit | cec7b1b3529dcc09298e01a243252045a0fb08bc (patch) | |
tree | 567fd5cdf488eaaf1b0328aef66226d02b1e7f6b | |
parent | cda401b58a3db7213eb14197680d401fd1399de9 (diff) | |
download | otp-cec7b1b3529dcc09298e01a243252045a0fb08bc.tar.gz otp-cec7b1b3529dcc09298e01a243252045a0fb08bc.tar.bz2 otp-cec7b1b3529dcc09298e01a243252045a0fb08bc.zip |
erts: Fix copy error in erlang:delete_element/2
Off-by-one error in element copy.
-rw-r--r-- | erts/emulator/beam/bif.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 9c438679ea..923bc50c40 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -2579,7 +2579,7 @@ BIF_RETTYPE delete_element_2(BIF_ALIST_3) Eterm* hp; Uint arity; Eterm res; - Sint ix; + Sint ix, c1, c2; if (is_not_tuple(BIF_ARG_2) || is_not_small(BIF_ARG_1)) { BIF_ERROR(BIF_P, BADARG); @@ -2597,14 +2597,12 @@ BIF_RETTYPE delete_element_2(BIF_ALIST_3) res = make_tuple(hp); *hp = make_arityval(arity - 1); - ix--; - arity -= ix; - - while (ix--) { *++hp = *++ptr; } + c1 = ix - 1; + c2 = arity - ix; + while (c1--) { *++hp = *++ptr; } ++ptr; - - while(arity--) { *++hp = *++ptr; } + while (c2--) { *++hp = *++ptr; } BIF_RET(res); } |