~ chicken-core (chicken-5) 0260c17679adeafcccc55c57c701eff97a1e8189


commit 0260c17679adeafcccc55c57c701eff97a1e8189
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:08:18 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 873b5538..ad62e4f2 100644
--- a/runtime.c
+++ b/runtime.c
@@ -5972,7 +5972,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;
   }
 
@@ -7805,7 +7805,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