Allow overlapping regions to be passed to `bytevector-copy!'.
Reported by Dmitry Chestnykh <dmitry@codingrobots.com>. Fixes <http://debbugs.gnu.org/10070>. * libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not `memcpy'. * test-suite/tests/bytevectors.test ("2.2 General Operations")["bytevector-copy! overlapping"]: New test. * doc/ref/api-data.texi (Bytevector Manipulation): Mention possible overlapping.
This commit is contained in:
parent
7f622b82a2
commit
8071964943
3 changed files with 14 additions and 6 deletions
|
|
@ -579,9 +579,9 @@ SCM_DEFINE (scm_bytevector_copy_x, "bytevector-copy!", 5, 0, 0,
|
|||
if (SCM_UNLIKELY (c_target_start + c_len > c_target_len))
|
||||
scm_out_of_range (FUNC_NAME, target_start);
|
||||
|
||||
memcpy (c_target + c_target_start,
|
||||
c_source + c_source_start,
|
||||
c_len);
|
||||
memmove (c_target + c_target_start,
|
||||
c_source + c_source_start,
|
||||
c_len);
|
||||
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue