Skip to content

with-simple-vector for "other implmentations" doesn't check for fill-pointer #44

@Yehouda

Description

@Yehouda

`(funcall (if (adjustable-array-p ,vector)

with-simple-vector doesn't check for arrays with fill-pointer, and calls the call-with-array-data/fast for such an array, which goes wrong (at least on LispWorks).

CL-USER 60 > (progn (setq  str (make-array 10 :fill-pointer 4 :element-type 'character)) 
                    (replace str "docs")
                    (BABEL:STRING-TO-OCTETS str))
#(244 130 155 134 0 0 0)

It can be fixed by changing the condition to (or (adjustable-array-p ,vector) (array-has-fill-pointer-p ,vector)), and with this it works as expected:

CL-USER 63 > (progn (setq  str (make-array 10 :fill-pointer 4 :element-type 'character)) 
                    (replace str "docs")
                    (BABEL:STRING-TO-OCTETS str))
#(100 111 99 115)

you get this problem if you do:

(ql:quickload "quri")
(quri:url-encode (quri:url-encode "docs"))

Because quri:url-encode returns a string with a fill-pointer.
Actually found it in the test of cl-ses4, because it does this double call:
https://github.com/Jach/cl-ses4/blob/14b9dc5ffb2fe93db82312e3eefbdd4164572b71/src/canonicalize.lisp#L49

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions