File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
java/ql/src/Likely Bugs/Comparison Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -168,10 +168,14 @@ Expr increaseOrDecreaseOfVar(SsaVariable v) {
168168}
169169
170170predicate overFlowTest ( ComparisonExpr comp ) {
171- exists ( SsaVariable v | comp .hasOperands ( increaseOrDecreaseOfVar ( v ) , v .getAUse ( ) ) )
172- or
173- comp .getLesserOperand ( ) = overFlowCand ( ) and
174- comp .getGreaterOperand ( ) .( IntegerLiteral ) .getIntValue ( ) = 0
171+ (
172+ exists ( SsaVariable v | comp .hasOperands ( increaseOrDecreaseOfVar ( v ) , v .getAUse ( ) ) )
173+ or
174+ comp .getLesserOperand ( ) = overFlowCand ( ) and
175+ comp .getGreaterOperand ( ) .( IntegerLiteral ) .getIntValue ( ) = 0
176+ ) and
177+ // exclude loop conditions as they are unlikely to be overflow tests
178+ not comp .getEnclosingStmt ( ) instanceof LoopStmt
175179}
176180
177181predicate concurrentModificationTest ( BinaryExpr test ) {
You can’t perform that action at this time.
0 commit comments