~ chicken-core (chicken-5) 2f7f0ec34d1083f11bff3a28bed9dd4de2c492d2
commit 2f7f0ec34d1083f11bff3a28bed9dd4de2c492d2
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: Mon Aug 31 05:51:27 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 331b6fbb..aabdf95a 100644
--- a/runtime.c
+++ b/runtime.c
@@ -7257,7 +7257,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