A4-7-1
: false positives in for loops
#798
Labels
false positive/false negative
An issue related to observed false positives or false negatives.
Affected rules
A4-7-1
Description
Typical increment by one in for loops cannot lead to overflow or wrap-around because the number of iterations isn't large enough. The example illustrates true negatives together with false positives:
f
the variable used as "loop counter" is defined inside or outside the scope of the loop,g
the number of iterations changes by a factor 100, although still not close to int limit - in general I think a query should take into account, if possible, the value used to initialize the counter and the (potential maximum) number of iterations.Example
The text was updated successfully, but these errors were encountered: