~ chicken-core (chicken-5) 470cda2d415e204a1ae82344e9a3055a753bebff


commit 470cda2d415e204a1ae82344e9a3055a753bebff
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Wed Jul 5 19:25:04 2023 +0200
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Thu Jul 6 11:15:28 2023 +0200

    make "tail?" more general and avoid segfault when passed an improper list
    
    (reported by "acdw")
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/library.scm b/library.scm
index b04b330a..ef7cefea 100644
--- a/library.scm
+++ b/library.scm
@@ -821,11 +821,12 @@ EOF
 
 (define (tail? x y)
   (##sys#check-list y 'tail?)
-  (or (##core#inline "C_eqp" x '())
-      (let loop ((y y))
-	(cond ((##core#inline "C_eqp" y '()) #f)
-	      ((##core#inline "C_eqp" x y) #t)
-	      (else (loop (##sys#slot y 1))) ) ) ) )
+  (let loop ((y y))
+    (cond ((##core#inline "C_eqp" x y) #t)
+          ((and (##core#inline "C_blockp" y)
+                (##core#inline "C_pairp" y))
+           (loop (##sys#slot y 1)))
+          (else #f))))
 
 (define intersperse
   (lambda (lst x)
diff --git a/manual/Acknowledgements b/manual/Acknowledgements
index 433103ea..fc3183aa 100644
--- a/manual/Acknowledgements
+++ b/manual/Acknowledgements
@@ -2,7 +2,7 @@
 
 == Acknowledgements
 
-Many thanks to "alicemaz", Jules Altfas, Nico Amtsberg, Alonso Andres, William
+Many thanks to "alicemaz", "acdw", Jules Altfas, Nico Amtsberg, Alonso Andres, William
 Annis, Jason E. Aten, Marc Baily, Peter Barabas, Andrei Barbu, Jonah
 Beckford, Arto Bendiken, Andy Bennett, Kevin Beranek, Peter Bex,
 Jean-Francois Bignolles, Oivind Binde, Alaric Blagrave Snell-Pym, Dave
Trap