diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll index fc9e4cfbaef..33b758d6439 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll +++ b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll @@ -1020,6 +1020,15 @@ module RangeStage Bounds, LangSig LangParam, UtilSig< or upper = false and delta = D::fromFloat(D::toFloat(d1).minimum(D::toFloat(d2))) ) + or + exists(SemExpr mid, D::Delta d, float f | + e.(SemNegateExpr).getOperand() = mid and + b instanceof SemZeroBound and + bounded(mid, b, d, upper.booleanNot(), fromBackEdge, origdelta, reason) and + f = -D::toFloat(d) and + delta = D::fromFloat(f) and + if semPositive(e) then f >= 0 else any() + ) ) }