~ chicken-core (chicken-5) f2fa0b11966e432886b86704808a063ad727329d
commit f2fa0b11966e432886b86704808a063ad727329d
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Sun Aug 30 17:48:48 2015 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Sun Aug 30 22:36:03 2015 +0200
Fix off-by-one error in C_values use of memmove.
It moves a block of memory one "to the left", so that the original
values at positions 2..n are copied over to 1..n-1. That means it
needs to copy n - 2 values, not n - 1 values.
Signed-off-by: felix <felix@call-with-current-continuation.org>
diff --git a/runtime.c b/runtime.c
index a8bed6cf..873b5538 100644
--- a/runtime.c
+++ b/runtime.c
@@ -6079,7 +6079,7 @@ void C_ccall C_values(C_word c, C_word *av)
/* Check continuation whether it receives multiple values: */
if(C_block_item(k, 0) == (C_word)values_continuation) {
av[ 0 ] = k; /* reuse av */
- C_memmove(av + 1, av + 2, (c - 1) * sizeof(C_word));
+ C_memmove(av + 1, av + 2, (c - 2) * sizeof(C_word));
C_do_apply(c - 1, av);
}
Trap