samples: Added sample int overflow query
This commit is contained in:
parent
b37960c8b7
commit
830306ecb0
12
codeql/samples/integer_overflow/findIntegerOverflow.ql
Normal file
12
codeql/samples/integer_overflow/findIntegerOverflow.ql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import cpp
|
||||||
|
import semmle.code.cpp.security.FlowSources
|
||||||
|
import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis
|
||||||
|
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
|
||||||
|
|
||||||
|
from RelationalOperation ro, AddExpr add, Expr exprOne, Expr exprTwo
|
||||||
|
where
|
||||||
|
add.getAnOperand() = exprOne and
|
||||||
|
add.getAnOperand() = exprTwo and
|
||||||
|
globalValueNumber(exprOne) = globalValueNumber(exprTwo) and
|
||||||
|
exprMightOverflowPositively(add) or exprMightOverflowNegatively(add)
|
||||||
|
select add
|
Loading…
Reference in New Issue
Block a user