Skip to content

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Jun 30, 2022

Move midpoint from Base.Sort to Base and use it to avoid integer overflow. Now

julia> vo = OffsetArray([1:4;], typemax(Int)-4)
4-element OffsetArray(::Vector{Int64}, 9223372036854775804:9223372036854775807) with eltype Int64 with indices 9223372036854775804:9223372036854775807:
 1
 2
 3
 4

julia> reverse!(vo)
4-element OffsetArray(::Vector{Int64}, 9223372036854775804:9223372036854775807) with eltype Int64 with indices 9223372036854775804:9223372036854775807:
 4
 3
 2
 1

Fixes #45870

@vtjnash vtjnash merged commit 3c04919 into JuliaLang:master Jun 30, 2022
@fredrikekre fredrikekre added backport 1.6 Change should be backported to release-1.6 backport 1.7 backport 1.8 Change should be backported to release-1.8 labels Jun 30, 2022
@jishnub jishnub deleted the reversefix branch July 1, 2022 01:09
KristofferC pushed a commit that referenced this pull request Jul 6, 2022
KristofferC pushed a commit that referenced this pull request Jul 6, 2022
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Jul 8, 2022
pcjentsch pushed a commit to pcjentsch/julia that referenced this pull request Aug 18, 2022
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
(cherry picked from commit 3c04919)
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
(cherry picked from commit 3c04919)
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
(cherry picked from commit 3c04919)
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
(cherry picked from commit 3c04919)
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
KristofferC pushed a commit that referenced this pull request Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.6 Change should be backported to release-1.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integer overflow in reverse! for an OffsetArray
4 participants