For Continue Increment
May 16, 2023 ยท View on GitHub
Configuration
- Check:
pess-for-continue-increment - Severity:
Medium - Confidence:
Low
Description
It's common practice to use unchecked {++i;} to save gas in for loops. However in this situation a continue statement before the index increase might lead to an infinite loop.
Vulnerable Scenario
Recommendation
- Perform the index increase before the continue statement
- Remove the gas saving unchecked increase
- Redesign the function