C++: Reintroduce the exprMightOverflowNegatively bit.

This commit is contained in:
Geoffrey White
2021-04-06 22:35:04 +01:00
parent 60e4faba4c
commit a8193dac08
3 changed files with 3 additions and 3 deletions

View File

@@ -72,5 +72,6 @@ where
ro.getLesserOperand().getValue().toInt() = 0 and
ro.getGreaterOperand() = sub and
sub.getFullyConverted().getUnspecifiedType().(IntegralType).isUnsigned() and
not exprIsSubLeftOrLess(sub, sub.getRightOperand())
exprMightOverflowNegatively(sub.getFullyConverted()) and // generally catches false positives involving constants
not exprIsSubLeftOrLess(sub, sub.getRightOperand()) // generally catches false positives where there's a relation between the left and right operands
select ro, "Unsigned subtraction can never be negative."