From dfffba54fb25bec0faa80127ed43fa3fd7cd4541 Mon Sep 17 00:00:00 2001 From: felix Date: Wed, 5 Jul 2023 19:25:04 +0200 Subject: [PATCH] make "tail?" more general and avoid segfault when passed an improper list (reported by "acdw") --- library.scm | 11 ++++++----- manual/Acknowledgements | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) 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 b9e81398..5923d4c7 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 -- 2.33.0