mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-24 05:21:20 -08:00
cmp: fix segmentation faults from coerce compiler macro
si::coerce-to-vector assumed that the to be coerced object had the
same length as that specified by the type. This lead to segmentation
faults even in safe code, for example in
(coerce '(a b c) '(vector * 4))
(coerce.error.3 test in ansi-tests)
Actually, si::coerce-to-vector had some checks for a correct length
previously, but they did not work correctly and were removed in commit
baaab01841.
This commit is contained in:
parent
00934b358b
commit
7e381828f1
1 changed files with 6 additions and 4 deletions
|
|
@ -288,10 +288,12 @@
|
|||
((subtypep type 'sequence)
|
||||
(multiple-value-bind (elt-type length)
|
||||
(si::closest-sequence-type type)
|
||||
(if (eq elt-type 'list)
|
||||
`(si::coerce-to-list ,value)
|
||||
`(si::coerce-to-vector ,value ',elt-type ',length
|
||||
,(and (subtypep type 'simple-array) t)))))
|
||||
(if (or (eq length '*) (policy-assume-right-type))
|
||||
(if (eq elt-type 'list)
|
||||
`(si::coerce-to-list ,value)
|
||||
`(si::coerce-to-vector ,value ',elt-type ',length
|
||||
,(and (subtypep type 'simple-array) t)))
|
||||
form)))
|
||||
;;
|
||||
;; There are no other atomic types to optimize
|
||||
((atom type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue