~ chicken-core (chicken-5) 259fa4bfedcbbd8a84639bf538f44bfb7f763603


commit 259fa4bfedcbbd8a84639bf538f44bfb7f763603
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Sat Sep 5 17:17:55 2015 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sun Sep 6 00:13:27 2015 +0200

    Replace two more memcpy calls with memmove.
    
    (apply apply ...) may result in memcpy of temporary stack into
    temporary stack.  This is triggered by syntax-tests.scm on OpenBSD
    when compiled with clang (thanks to Alex Shendi for reporting this)
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/runtime.c b/runtime.c
index aabdf95a..c9c9d944 100644
--- a/runtime.c
+++ b/runtime.c
@@ -7150,7 +7150,7 @@ void C_ccall C_apply(C_word c, C_word *av)
   *(ptr++) = k;
 
   if(n > 1) {
-    C_memcpy(ptr, av + 3, m * sizeof(C_word));
+    C_memmove(ptr, av + 3, m * sizeof(C_word));
     ptr += m;
   }
 
@@ -11353,7 +11353,7 @@ void C_ccall C_make_structure(C_word c, C_word *av)
 {
   if(!C_demand(c - 1)) {
     C_temporary_stack = C_temporary_stack_bottom - (c - 1);
-    C_memcpy(C_temporary_stack, av + 1, (c - 1) * sizeof(C_word));
+    C_memmove(C_temporary_stack, av + 1, (c - 1) * sizeof(C_word));
     C_reclaim((void *)make_structure_2, c - 1);
   }
 
Trap