Skip to content

Commit

Permalink
FIX: possible fix of Valgrind's `Source and destination overlap in me…
Browse files Browse the repository at this point in the history
…mcpy` error.
  • Loading branch information
Oldes committed Dec 8, 2020
1 parent 3e9ac3b commit 10932d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/t-money.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
/*
***********************************************************************/
{
REBCNT len;
REBCNT len=0;
REBYTE buf[MAX_HEX_LEN+4] = {0}; // binary to convert

if (IS_BINARY(val)) {
Expand All @@ -95,7 +95,7 @@
}
}
#endif
memcpy(buf + 12 - len, buf, len); // shift to right side
memmove(buf + 12 - len, buf, len); // shift to right side
memset(buf, 0, 12 - len);
VAL_DECI(result) = binary_to_deci(buf);
return TRUE;
Expand Down
6 changes: 3 additions & 3 deletions src/tests/units/money-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Rebol [
===start-group=== "make money!"
--test-- "make money! percent!"
;@@ https://github.com/Oldes/Rebol-issues/issues/971
; --assert $0 = try [make money! 0%]
; --assert $1 = try [make money! 100%]
; --assert $100 = try [make money! make percent! $100]
--assert $0 = try [make money! 0%]
--assert $1 = try [make money! 100%]
--assert $100 = try [make money! make percent! $100]

--test-- "make money! binary!"
;@@ https://github.com/Oldes/Rebol-issues/issues/1060
Expand Down

0 comments on commit 10932d1

Please sign in to comment.