File tree Expand file tree Collapse file tree
cpp/ql/src/experimental/Security/CWE/CWE-191 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/**
22 * @name Unsigned difference expression compared to zero
3- * @description It is highly probable that the condition is wrong if the difference expression has the unsigned type.
4- * The condition holds in all the cases when difference is not equal to zero. It means that we may use condition not equal.
3+ * @description It is highly probable that the condition is wrong if the difference expression has the unsigned type.
4+ * The condition holds in all the cases when difference is not equal to zero. It means that we may use condition not equal.
55 * But the programmer probably wanted to compare the difference of elements.
66 * @kind problem
77 * @id cpp/unsigned-difference-expression-compared-zero
@@ -16,8 +16,8 @@ import semmle.code.cpp.commons.Exclusions
1616
1717from RelationalOperation ro , SubExpr sub
1818where
19- not isFromMacroDefinition ( ro ) and
19+ not isFromMacroDefinition ( ro ) and
2020 ro .getLesserOperand ( ) .getValue ( ) .toInt ( ) = 0 and
2121 ro .getGreaterOperand ( ) = sub and
2222 sub .getFullyConverted ( ) .getUnspecifiedType ( ) .( IntegralType ) .isUnsigned ( )
23- select ro , " difference in condition is always greater than or equal to zero "
23+ select ro , "Difference in condition is always greater than or equal to zero"
You can’t perform that action at this time.
0 commit comments