Potential infinite loop #172
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-152
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/tokens/ERC20Gauges.sol#L532-L534
Vulnerability details
Impact
The loop contains a misplaced increment operation
i++
, which could lead to an infinite loop ifuserGaugeWeight
is zero, asi
would never be incremented.Proof of Concept
The related code snippet is part of a loop that iterates over a list of gauges to calculate weights and perform certain updates. However, there is a potential issue with the position of the
i++
increment operation within the loop. It is placed inside an unchecked block and within a conditional statement that checks ifuserGaugeWeight
is not equal to zero. IfuserGaugeWeight
is zero for any gauge, the increment will be skipped, potentially causing an infinite loop as the indexi
will not be updated.Tools Used
Recommended Mitigation Steps
Assessed type
Loop
The text was updated successfully, but these errors were encountered: