Skip to content

OffsetArray accesses out-of-bounds memory and returns an incorrect value when indexing with [] #194

Closed
@yurivish

Description

@yurivish

It is possible that this happens due to an incorrect use of @inbounds:

julia> using OffsetArrays

julia> OffsetArray([0], 1)[]
4562921808

julia> [OffsetArray([0], 1)[] for _ in 1:10]
10-element Array{Int64,1}:
           0
  4396158144
  4582191936
  4582191936
  4396158144
           0
  4396158144
  8589934592
 12884901888
           0

julia> OffsetArray([0], 100:100)[]
4614560496
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

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