Skip to content

Bug: Negative array dimensions permitted when using :displaced-to with make-array #697

@fosskers

Description

@fosskers

I discovered this today while unit testing a new library of mine.

This will throw:

(make-array -5 :element-type 'character)

citing:

The size specified for this array (-5) is negative.

However, this will happily succeed:

(make-array -5 :element-type 'character :displaced-to "hello")

This yields an empty string. Each other Lisp implementation I tried throws a condition here. Looking at the Java, we see that the dimension isn't checked for negativity when handling :displaced-to, but that it is for other normal cases.

Cheers.

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