Skip to content

isassigned: incorrect bounds check for ndims > 1 #47942

@stevengj

Description

@stevengj

This looks like a long-buried bug, recently identified on discourse:

julia> isassigned(zeros(161,517), 500, 514) # should be false
true

The problem is that the isassigned code is checking only the linear index and not the multidimensional index, which is sufficient to prevent a crash but insufficient to check bounds for multidimensional indices.

cc @timholy, since this code originated in #11167, and @yuyichao who optimized this code (but did not change the semantics) in #20890.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions