mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
CPP: Optimize isRandValue.
This commit is contained in:
@@ -16,12 +16,19 @@ import semmle.code.cpp.security.Overflow
|
|||||||
import semmle.code.cpp.security.Security
|
import semmle.code.cpp.security.Security
|
||||||
import semmle.code.cpp.security.TaintTracking
|
import semmle.code.cpp.security.TaintTracking
|
||||||
|
|
||||||
|
predicate isRandCall(FunctionCall fc) { fc.getTarget().getName() = "rand" }
|
||||||
|
|
||||||
|
predicate isRandCallOrParent(Expr e) {
|
||||||
|
isRandCall(e) or
|
||||||
|
isRandCallOrParent(e.getAChild())
|
||||||
|
}
|
||||||
|
|
||||||
predicate isRandValue(Expr e) {
|
predicate isRandValue(Expr e) {
|
||||||
e.(FunctionCall).getTarget().getName() = "rand"
|
isRandCall(e)
|
||||||
or
|
or
|
||||||
exists(MacroInvocation mi |
|
exists(MacroInvocation mi |
|
||||||
e = mi.getExpr() and
|
e = mi.getExpr() and
|
||||||
e.getAChild*().(FunctionCall).getTarget().getName() = "rand"
|
isRandCallOrParent(e)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user