From 03ee87824b7a2e9b3e8eb05a713b01646c063090 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sun, 30 Aug 2015 17:48:48 +0200 Subject: [PATCH] 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. --- runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime.c b/runtime.c index a8bed6c..873b553 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); } -- 2.1.4