#49690 [SC-Low] Integer Underflow in UInt64SetLib.py
Description
@subroutine
def remove_item(to_remove: UInt64, items: DynamicArray[ARC4UInt64]) -> Tuple[Bool,
DynamicArray[ARC4UInt64]]:
last_idx = items.length - 1 # ← VULNERABLE LINE
for idx, item in uenumerate(items):
if item.native == to_remove:
last_item = items.pop()
if idx != last_idx:
items[idx] = last_item
return Bool(True), items.copy()
return Bool(False), items.copy()Proof of Concept
Proof of Concept
Recommended Fix
Previous#49559 [SC-Low] The remove functionality in `UInt64SetLib::remove_item` underflows on empty arrayNext#49687 [SC-Low] An underflow in `remove_item` function in `Uint64SetLib` Contract.
Was this helpful?