-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 check in step range does not take into account overflow #26623
Labels
domain:ranges
Everything AbstractRange
kind:bug
Indicates an unexpected problem or unintended behavior
Comments
mbauman
added
kind:bug
Indicates an unexpected problem or unintended behavior
domain:arrays
[a, r, r, a, y, s]
labels
Mar 26, 2018
Still overflowing on 1.8 and 1.9, FWIW
|
LilithHafner
added
domain:ranges
Everything AbstractRange
and removed
domain:arrays
[a, r, r, a, y, s]
labels
Jun 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
domain:ranges
Everything AbstractRange
kind:bug
Indicates an unexpected problem or unintended behavior
For example
This happens because
first(v) + (i - 1)*step_hp(v))
ingetindex
can overflow. A solution is to usecheckbounds(1:3:4, 6148914691236517207)
which will throw a BoundsError for the above, but is not suitable for step ranges where the length cannot be represented in the integer type:checkbounds(-10:1:typemax(Int), 10)
throws an OverflowError.The text was updated successfully, but these errors were encountered: