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

Skip to content

Commit 0f77403

Browse files
committed
Python: small start on global flow
need to actually have `OutNode`s
1 parent f3e879a commit 0f77403

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

python/ql/src/semmle/code/python/dataflow/internal/DataFlowPrivate.qll

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private import DataFlowPublic
99
// Nodes
1010
//--------
1111

12-
class DataFlowCall extends Call {
12+
class DataFlowCall extends CallNode {
1313
/** Gets the enclosing callable of this call. */
1414
abstract DataFlowCallable getEnclosingCallable();
1515
}
@@ -103,17 +103,26 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
103103
// Global flow
104104
//--------
105105

106-
class DataFlowCallable = FunctionValue;
106+
import semmle.python.pointsto.CallGraph
107+
108+
class DataFlowCallable = FunctionObject;
107109

108110
/** Gets a viable run-time target for the call `call`. */
109-
DataFlowCallable viableCallable(DataFlowCall call) { none() }
111+
DataFlowCallable viableCallable(DataFlowCall call) {
112+
exists(FunctionInvocation i |
113+
call = i.getCall() and
114+
result = i.getFunction())
115+
}
110116

111117
/**
112118
* Gets a node that can read the value returned from `call` with return kind
113119
* `kind`.
114120
*/
115121
OutNode getAnOutNode(DataFlowCall call, ReturnKind kind) { call = result.getCall(kind) }
116122

123+
// Extend OutNode here
124+
// Consider whether to use AST nodes rather than CFG nodes
125+
117126
//--------
118127
// Type pruning
119128
//--------

0 commit comments

Comments
 (0)