_decrementWeightUntilFree() Possible infinite loop #735
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
M-09
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/erc-20/ERC20Gauges.sol#L547-L549
Vulnerability details
Impact
the position of
i++
is wrong, which may lead to an infinite loopProof of Concept
In the loop of the
_decrementWeightUntilFree()
method, the position ofi++
is wrong, which may lead to a infinite loopIn the above code, when
userGaugeWeight == 0
,i
is not incremented, resulting in a infinite loop.The current protocol does not restrict
getUserGaugeWeight[user][gauge] == 0
.Tools Used
Recommended Mitigation Steps
Assessed type
Context
The text was updated successfully, but these errors were encountered: