Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 69ed608

Browse files
authored
Update UnsignedDifferenceExpressionComparedZero.ql
1 parent d088d5b commit 69ed608

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cpp/ql/src/experimental/Security/CWE/CWE-191/UnsignedDifferenceExpressionComparedZero.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
*/
1313

1414
import cpp
15+
import semmle.code.cpp.commons.Exclusions
1516

1617
from RelationalOperation ro, SubExpr sub
1718
where
19+
not isFromMacroDefinition(ro) and
1820
ro.getLesserOperand().getValue().toInt() = 0 and
1921
ro.getGreaterOperand() = sub and
20-
sub.getType().(IntegralType).isUnsigned()
21-
22-
select ro , " difference in condition is always greater than or equal to zero "
22+
sub.getFullyConverted().getUnspecifiedType().(IntegralType).isUnsigned()
23+
select ro , " difference in condition is always greater than or equal to zero "

0 commit comments

Comments
 (0)