Commit a297e86d authored by Samuel Freilich's avatar Samuel Freilich

Check that input is a list in proper-list-length

proper-list-length and related functions claim to signal an error if the
input is not a proper list, and are careful to safely check that the cdr
is a cons (with safe-endp). However, they call cdr on the input without
checking that it is a list in the first place, resulting in memory-error
when compiled with safety 0 instead of type-error as the tests expect.
parent 5e5c7d83
...@@ -193,6 +193,8 @@ designator of the expected type in a TYPE-ERROR." ...@@ -193,6 +193,8 @@ designator of the expected type in a TYPE-ERROR."
(assert (member 'list lambda-list)) (assert (member 'list lambda-list))
`(defun ,name ,lambda-list `(defun ,name ,lambda-list
,doc ,doc
(unless (listp list)
(error 'type-error :datum list :expected-type 'list))
(do ((last list fast) (do ((last list fast)
(fast list (cddr fast)) (fast list (cddr fast))
(slow (cons (car list) (cdr list)) (cdr slow)) (slow (cons (car list) (cdr list)) (cdr slow))
  • Thank you.

    Would you mind adding a test, please?

  • It's covered by existing tests, I only found the issue because an existing test was broken.

    I suppose I could add a duplicate test that's forced to run with (safety 0)?

  • Hmmm, right.

    Perhaps you could make all tests run once with (safety 3) and then with (safety 0)?

  • That's what's happening on my end already, but I'm using a different continuous testing system here. I'm not sure what the best way to set that up in ASDF is, since I'm not very familiar with ASDF.

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment