mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
24 lines
684 B
Plaintext
24 lines
684 B
Plaintext
import experimental.dataflow.DataFlow
|
|
|
|
/**
|
|
* A configuration to find all "maximal" flows.
|
|
* To be used on small programs.
|
|
*/
|
|
class MaximalFlowsConfig extends DataFlow::Configuration {
|
|
MaximalFlowsConfig() { this = "AllFlowsConfig" }
|
|
|
|
override predicate isSource(DataFlow::Node node) {
|
|
node instanceof DataFlow::ParameterNode
|
|
or
|
|
node instanceof DataFlow::EssaNode and
|
|
not exists(DataFlow::EssaNode pred | DataFlow::localFlowStep(pred, node))
|
|
}
|
|
|
|
override predicate isSink(DataFlow::Node node) {
|
|
node instanceof DataFlow::ReturnNode
|
|
or
|
|
node instanceof DataFlow::EssaNode and
|
|
not exists(node.(DataFlow::EssaNode).getVar().getASourceUse())
|
|
}
|
|
}
|