summaryrefslogtreecommitdiff
path: root/libguile/bytevectors.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-11-20 01:10:58 +0100
committerLudovic Courtès <ludo@gnu.org>2011-11-20 01:10:58 +0100
commit8071964943e23700cfe1095ba0f5e3c99f590dee (patch)
tree3ed067e04e620eb013fb26f9f7de5863bb6c9eeb /libguile/bytevectors.c
parent7f622b82a2ada4af1f78e27d1ef9ad1498305287 (diff)
downloadguile-8071964943e23700cfe1095ba0f5e3c99f590dee.tar.gz
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.
Diffstat (limited to 'libguile/bytevectors.c')
-rw-r--r--libguile/bytevectors.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 4aeae63b0..fff53550c 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -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;
}