~ chicken-core (chicken-5) d530de2f7623629dc38f99c6b0c4d5127dea743a


commit d530de2f7623629dc38f99c6b0c4d5127dea743a
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Jun 20 15:40:49 2011 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Jun 20 15:40:49 2011 +0200

    immediate non-null argument to list-tail resulted in crashing type-check (reported by Sven Hartrumpf)

diff --git a/runtime.c b/runtime.c
index d2a36a0b..f6e0b934 100644
--- a/runtime.c
+++ b/runtime.c
@@ -4832,7 +4832,8 @@ C_regparm C_word C_fcall C_i_list_tail(C_word lst, C_word i)
   C_word lst0 = lst;
   int n;
 
-  if(lst != C_SCHEME_END_OF_LIST && C_block_header(lst) != C_PAIR_TAG)
+  if(lst != C_SCHEME_END_OF_LIST && 
+     (C_immediatep(lst) || C_block_header(lst) != C_PAIR_TAG))
     barf(C_BAD_ARGUMENT_TYPE_ERROR, "list-tail", lst);
 
   if(i & C_FIXNUM_BIT) n = C_unfix(i);
Trap