Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounds error getting pointer of ReinterpretArray on 1.8+ #46113

Closed
IanButterworth opened this issue Jul 20, 2022 · 0 comments · Fixed by #46114
Closed

Bounds error getting pointer of ReinterpretArray on 1.8+ #46113

IanButterworth opened this issue Jul 20, 2022 · 0 comments · Fixed by #46114
Assignees
Labels
regression Regression in behavior compared to a previous version

Comments

@IanButterworth
Copy link
Member

VideoIO tests are failing on 1.8 & master when a pointer is requested on a ReinterpretArray, repeatably but only some conditions
JuliaIO/VideoIO.jl#374

I serialized the array in 1.7, to reproduce the issue easily
1.7

julia> using ColorTypes, FixedPointNumbers

julia> img = deserialize("img")
100×100 reinterpret(UInt8, reinterpret(reshape, N0f8, ::Array{Gray{N0f8},2})):
 0x9d  0x46  0x5c  0xf5  0xbe  0xbc  0xa7  0x15  0xb4  0x27  0xd6  0x5f  …  0xfc  0xf6  0xf2  0xed  0xe1  0x0f  0xcd  0x02  0xba  0x1e  0xcc  0x81
...

julia> pointer(img, 1)
Ptr{UInt8} @0x00007fbb9ef2de80

1.8

julia> using ColorTypes, FixedPointNumbers

julia> img = deserialize("img")
100×100 reinterpret(UInt8, reinterpret(reshape, N0f8, ::Array{Gray{N0f8},2})):
 0x9d  0x46  0x5c  0xf5  0xbe  0xbc  0xa7  0x15  0xb4  0x27  0xd6  0x5f  0xc9  …  0x27  0xfc  0xf6  0xf2  0xed  0xe1  0x0f  0xcd  0x02  0xba  0x1e  0xcc  0x81
...

julia> pointer(img,1)
ERROR: BoundsError: attempt to access Tuple{} at index [1]
Stacktrace:
 [1] getindex(t::Tuple, i::Int64)
   @ Base ./tuple.jl:29
 [2] (::Base.var"#51#52")(t::Tuple{})
   @ Base ./tuple.jl:261
 [3] map(f::Base.var"#51#52", t::Tuple{Tuple{Int64}, Tuple{}, Tuple{Int64}})
   @ Base ./tuple.jl:223
 [4] heads(::Tuple{Int64}, ::Vararg{Tuple})
   @ Base ./tuple.jl:261
 [5] map (repeats 2 times)
   @ ./tuple.jl:266 [inlined]
 [6] _memory_offset(x::Base.ReinterpretArray{UInt8, 2, N6f10, Base.ReinterpretArray{N6f10, 2, Gray{N6f10}, Matrix{Gray{N6f10}}, true}, false}, I::Int64)
   @ Base ./abstractarray.jl:1192
 [7] pointer(x::Base.ReinterpretArray{UInt8, 2, N6f10, Base.ReinterpretArray{N6f10, 2, Gray{N6f10}, Matrix{Gray{N6f10}}, true}, false}, i::Int64)
   @ Base ./abstractarray.jl:1185
 [8] top-level scope
   @ REPL[31]:1

Here's the serialized img (as .txt so it can be attached)
img.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants