#48983 [SC-Low] Potential Underflow in remove_item() on Empty Array
Description
Brief/Intro
Vulnerability Details
@subroutine
def remove_item(to_remove: UInt64, items: DynamicArray[ARC4UInt64]) -> Tuple[Bool, DynamicArray[ARC4UInt64]]:
last_idx = items.length - 1
for idx, item in uenumerate(items):
if item.native == to_remove:
# remove last item to replace the "to_remove" item or remove entirely if it's the match
last_item = items.pop()
if idx != last_idx:
items[idx] = last_item
# return with the item removed
return Bool(True), items.copy()
# if here then item is not present
return Bool(False), items.copy()Impact Details
References
Proof of Concept
Proof of Concept
Previous#48894 [SC-Low] Underflow in index calculation fails remove_itemNext#48990 [SC-Low] Integer underflow in remove_item leads to AVM trap and DoS via empty array call
Was this helpful?