Skip to content

Fix integer overflow bug in binary search#2

Merged
AnshulMalik merged 1 commit into
TheAlgorithms:masterfrom
crazymerlyn:fix-overflow-bug
Sep 30, 2018
Merged

Fix integer overflow bug in binary search#2
AnshulMalik merged 1 commit into
TheAlgorithms:masterfrom
crazymerlyn:fix-overflow-bug

Conversation

@crazymerlyn
Copy link
Copy Markdown
Contributor

left + right can be outside the range of 32bit numbers even if left and right are not. This can lead to bugs on 32bit systems. See Nearly All Binary Searches and Mergesorts are Broken.

@AnshulMalik
Copy link
Copy Markdown
Member

Great catch there! @christianbender . Thanks :)

@AnshulMalik AnshulMalik merged commit 8723aa3 into TheAlgorithms:master Sep 30, 2018
@crazymerlyn crazymerlyn deleted the fix-overflow-bug branch October 2, 2018 07:26
BogdanCiocea added a commit to BogdanCiocea/Rust that referenced this pull request Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants