mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
import TestUtilities.dataflow.FlowTestCommon
|
|
|
|
module AstTest {
|
|
private import semmle.code.cpp.dataflow.TaintTracking
|
|
|
|
class AstSmartPointerTaintConfig extends TaintTracking::Configuration {
|
|
AstSmartPointerTaintConfig() { this = "ASTSmartPointerTaintConfig" }
|
|
|
|
override predicate isSource(DataFlow::Node source) {
|
|
source.asExpr().(FunctionCall).getTarget().getName() = "source"
|
|
}
|
|
|
|
override predicate isSink(DataFlow::Node sink) {
|
|
exists(FunctionCall call |
|
|
call.getTarget().getName() = "sink" and
|
|
sink.asExpr() = call.getAnArgument()
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
module IRTest {
|
|
private import semmle.code.cpp.ir.dataflow.TaintTracking
|
|
|
|
class IRSmartPointerTaintConfig extends TaintTracking::Configuration {
|
|
IRSmartPointerTaintConfig() { this = "IRSmartPointerTaintConfig" }
|
|
|
|
override predicate isSource(DataFlow::Node source) {
|
|
source.asExpr().(FunctionCall).getTarget().getName() = "source"
|
|
}
|
|
|
|
override predicate isSink(DataFlow::Node sink) {
|
|
exists(FunctionCall call |
|
|
call.getTarget().getName() = "sink" and
|
|
sink.asExpr() = call.getAnArgument()
|
|
)
|
|
}
|
|
}
|
|
}
|