CodeQL library for C/C++
codeql/cpp-all 0.12.10 (changelog, source)
Search

Predicate convertedExprMightOverflowNegatively

Holds if the expression might overflow negatively. Conversions are also taken into account. For example the expression (int16)(x+y) might overflow due to the (int16) cast, rather than due to the addition.

Import path

import semmle.code.cpp.rangeanalysis.new.SimpleRangeAnalysis
predicate convertedExprMightOverflowNegatively(Expr expr)