aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2013-03-07 15:58:10 +0100
committerBjörn-Egil Dahlberg <[email protected]>2013-03-12 16:42:12 +0100
commitcec7b1b3529dcc09298e01a243252045a0fb08bc (patch)
tree567fd5cdf488eaaf1b0328aef66226d02b1e7f6b /erts
parentcda401b58a3db7213eb14197680d401fd1399de9 (diff)
downloadotp-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.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/bif.c12
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);
}