Skip to content

Commit ed64ed3

Browse files
committed
C++: Make exprMightOverflowPositively/exprMightOverFlowNegatively hold for unanalyzable expressions. This hopefully means that expressions that do not satisfy these predicates will never overflow/underflow.
1 parent 447f339 commit ed64ed3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cpp/ql/src/semmle/code/cpp/rangeanalysis/SimpleRangeAnalysis.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,9 @@ private module SimpleRangeAnalysisCached {
16301630
// bound of `x`, so the standard logic (above) does not work for
16311631
// detecting whether it might overflow.
16321632
getLowerBoundsImpl(expr.(PostfixDecrExpr)) = exprMinVal(expr)
1633+
or
1634+
// Expressions we cannot analyze could potentially overflow
1635+
not analyzableExpr(expr)
16331636
}
16341637

16351638
/**
@@ -1657,6 +1660,9 @@ private module SimpleRangeAnalysisCached {
16571660
// bound of `x`, so the standard logic (above) does not work for
16581661
// detecting whether it might overflow.
16591662
getUpperBoundsImpl(expr.(PostfixIncrExpr)) = exprMaxVal(expr)
1663+
or
1664+
// Expressions we cannot analyze could potentially overflow
1665+
not analyzableExpr(expr)
16601666
}
16611667

16621668
/**

0 commit comments

Comments
 (0)