Empty-type vectors are written as junk strings

Bug #1311421 reported by James M. Lawrence
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

* (write (make-array 10 :element-type nil))
"£KÇ...<other junk>"

Possibly this could be a security concern? In any case it's crude.

New version:

* (write (make-array 10 :element-type nil))
#<(SIMPLE-ARRAY NIL (10)) {C9FEC8F}>

Vectors of the empty type that are empty may be printed readably:

* (write (make-array 0 :element-type nil) :readably t)
#.(COERCE #() '(SIMPLE-ARRAY NIL (*)))

Revision history for this message
James M. Lawrence (llmjjmll) wrote :
Revision history for this message
James M. Lawrence (llmjjmll) wrote :

On second thought, I suppose this violates the specification (http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-4.html), which says that a double-quote must be printed before and after. Therefore "" would be the representation of an empty string with characters of type nil.

Thus the fix would be to signal an error when an element of an empty-type string is accessed via the stream functionality, just as using AREF signals an error.

Changed in sbcl:
status: New → Invalid
Stas Boukarev (stassats)
Changed in sbcl:
status: Invalid → Triaged
Revision history for this message
Stas Boukarev (stassats) wrote :

This was caused by errors for accessing nil-arrays falling through. Fixed in 76f4df573f6c4fe9063e2d22c8672ddf831a3d14

Changed in sbcl:
status: Triaged → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.