~ chicken-core (chicken-5) 9e4fef8566faf944838586a9d11f9426d64de2fe


commit 9e4fef8566faf944838586a9d11f9426d64de2fe
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Nov 8 10:19:11 2010 -0500
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Nov 8 10:19:11 2010 -0500

    list-tail should check list argument type

diff --git a/runtime.c b/runtime.c
index 33bed5cd..bea726bf 100644
--- a/runtime.c
+++ b/runtime.c
@@ -4816,6 +4816,9 @@ 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)
+    barf(C_BAD_ARGUMENT_TYPE_ERROR, "list-tail", lst);
+
   if(i & C_FIXNUM_BIT) n = C_unfix(i);
   else barf(C_BAD_ARGUMENT_TYPE_ERROR, "list-tail", i);
 
Trap