~ chicken-core (chicken-5) 0f20eec89c3e98a5fa0fe4e44503e11dc288d697


commit 0f20eec89c3e98a5fa0fe4e44503e11dc288d697
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Jul 17 12:04:23 2015 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri Jul 17 12:04:23 2015 +0200

    C_call_with_values: fetch args after checking argc

diff --git a/runtime.c b/runtime.c
index d5760e9a..27726cb7 100644
--- a/runtime.c
+++ b/runtime.c
@@ -6136,13 +6136,16 @@ void C_ccall C_call_with_values(C_word c, C_word *av)
   C_word
     /* closure = av[ 0 ] */
     k = av[ 1 ],
-    thunk = av[ 2 ],
-    kont = av[ 3 ],
+    thunk,
+    kont,
     *a = C_alloc(4),
     kk;
 
   if(c != 4) C_bad_argc(c, 4);
 
+  thunk = av[ 2 ];
+  kont = av[ 3 ];
+
   if(C_immediatep(thunk) || C_header_bits(thunk) != C_CLOSURE_TYPE)
     barf(C_BAD_ARGUMENT_TYPE_ERROR, "call-with-values", thunk);
 
Trap