#1301 closed defect (fixed)
bug in write-perverted-string
Reported by: | informatimago | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Compiler | Version: | trunk |
Keywords: | Cc: |
Description
In write-perverted-string in l1-io.lisp, there's a bug in computing the length of outbuf (assuming the code in its body does what it should do), when escape is not nil:
(block bug (let ((string (string '|\\; \".1|))) (handler-bind ((error (lambda (err) (princ err) (terpri) (return-from bug)))) (ccl::write-perverted-string string *standard-output* (length string) :downcase #\") (values)))) "\\; \".1" ; No value (block bug (let ((string (string '|\\; \".1|))) (handler-bind ((error (lambda (err) (princ err) (terpri) (return-from bug)))) (ccl::write-perverted-string string *standard-output* (length string) :downcase nil) (values)))) Array index 6 out of bounds for "\\\\; \"." . nil
Using the following formula should correct it:
(outbuf (make-string (+ end (if escape 2 0) (count-if (lambda (c) (or (eql c escape) (eql c #\\))) string :end end))))
Note: it might be a good idea to rename the parameter escape to quote.
Change History (4)
comment:1 Changed 4 years ago by informatimago
comment:2 Changed 4 years ago by rme
- Resolution set to fixed
- Status changed from new to closed
(In [16516]) Apply fix to write-perverted-string from ticket:1301.
Closes ticket:1301 and ticket:1135.
comment:3 Changed 4 years ago by rme
Thank you.
comment:4 Changed 3 years ago by rme
- Milestone Clozure CL 1.10 deleted
Milestone Clozure CL 1.10 deleted
Note: See
TracTickets for help on using
tickets.
cf. Ticket #1135 20 months ago!!!