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
Add bounds check for length of passed indices and values #18
Comments
julia> dump(c)
IndirectArray{String,1,Array{Int64,1},Array{String,1}}
index: Array{Int64}((6,)) [1, 1, 1, 2, 2, 2]
values: Array{String}((6,))
1: String "A"
2: String "A"
3: String "A"
4: String "B"
5: String "B"
6: String "B" So it looks like it is working, but it needs a bounds check or something because it requires that |
Strictly speaking what it required is julia> IndirectArray([1,10], ["a"]);
ERROR: BoundsError: attempt to access 1-element Array{String,1} at index [[1, 10]] Providing some duplicated and some unused levels as in your example isn't very useful, but I'm not sure it should be forbidden. |
Right, a good example is let's say you want to provide a gray color scale for an indexed image, but color saturated pixels red. I might get a constant stream of images from my camera, some of which might have saturated pixels and others not; I don't want to have to change my color map dependent on whether pixels actually "hit" each value or not. |
@timholy your explanation makes a lot of sense. I was suspecting that something like that was the reasoning. Thanks! |
This seems like a pretty massive bug unless I'm totally reading this wrongI was reading this wrong, but this check should still occur.IndirectArrays v0.5.0
The text was updated successfully, but these errors were encountered: