TheAlgorithms / Solidity

Algorithms and data structures implemented in Solidity
GNU Lesser General Public License v2.1
332 stars 95 forks source link

[BUG] Possible underflow in binary search #85

Closed Vikram710 closed 1 year ago

Vikram710 commented 1 year ago

Possible underflow in binary search here

example input arr = {2} target = 1

middle will be 0 maximum = middle - 1; 0 -1 0x11: If an arithmetic operation results in underflow or overflow outside of an unchecked { ... } block.

Adi9876 commented 1 year ago

@Panquesito7 assign me this task i can fix it !!

Adi9876 commented 1 year ago

@mkubdev @Panquesito7 can you please check my updated code also verify the pull request that i made !! FIXED THE BUG !!