Skip to content

Commit 6df3b8d

Browse files
committed
Python: Update query and expectation
1 parent 9baa7b7 commit 6df3b8d

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +0,0 @@
1-
| test.py:9:1:9:13 | ControlFlowNode for FunctionExpr | test.py:16:9:16:14 | ControlFlowNode for source |
2-
| test.py:9:1:9:13 | ControlFlowNode for FunctionExpr | test.py:24:9:24:14 | ControlFlowNode for source |
3-
| test.py:9:1:9:13 | ControlFlowNode for FunctionExpr | test.py:44:12:44:17 | ControlFlowNode for source |
4-
| test.py:12:1:12:14 | ControlFlowNode for FunctionExpr | test.py:21:5:21:8 | ControlFlowNode for sink |
5-
| test.py:12:1:12:14 | ControlFlowNode for FunctionExpr | test.py:25:5:25:8 | ControlFlowNode for sink |
6-
| test.py:12:1:12:14 | ControlFlowNode for FunctionExpr | test.py:47:5:47:8 | ControlFlowNode for sink |
7-
| test.py:12:1:12:14 | ControlFlowNode for FunctionExpr | test.py:51:9:51:12 | ControlFlowNode for sink |
8-
| test.py:43:1:43:17 | ControlFlowNode for FunctionExpr | test.py:54:9:54:15 | ControlFlowNode for source2 |
9-
| test.py:46:1:46:15 | ControlFlowNode for FunctionExpr | test.py:55:5:55:9 | ControlFlowNode for sink2 |
10-
| test.py:49:1:49:21 | ControlFlowNode for FunctionExpr | test.py:63:5:63:9 | ControlFlowNode for sink3 |
11-
| test.py:49:1:49:21 | ControlFlowNode for FunctionExpr | test.py:70:5:70:9 | ControlFlowNode for sink3 |
12-
| test.py:72:1:72:13 | ControlFlowNode for FunctionExpr | test.py:77:9:77:11 | ControlFlowNode for hub |
13-
| test.py:72:1:72:13 | ControlFlowNode for FunctionExpr | test.py:82:9:82:11 | ControlFlowNode for hub |

python/ql/test/experimental/dataflow/regression/pointsto.ql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
private import python
2-
import experimental.dataflow.DataFlow
2+
import semmle.python.dataflow.new.DataFlow
33

4-
predicate pointsToOrigin(DataFlow::DataFlowCfgNode pointer, DataFlow::DataFlowCfgNode origin) {
5-
origin = pointer.pointsTo().getOrigin()
4+
predicate pointsToOrigin(DataFlow::CfgNode pointer, DataFlow::CfgNode origin) {
5+
origin.getNode() = pointer.getNode().pointsTo().getOrigin()
66
}
77

88
class PointsToConfiguration extends DataFlow::Configuration {
99
PointsToConfiguration() { this = "PointsToConfiguration" }
1010

11-
override predicate isSource(DataFlow::Node node) { pointsToOrigin(_, node.asCfgNode()) }
11+
override predicate isSource(DataFlow::Node node) { pointsToOrigin(_, node) }
1212

13-
override predicate isSink(DataFlow::Node node) { pointsToOrigin(node.asCfgNode(), _) }
13+
override predicate isSink(DataFlow::Node node) { pointsToOrigin(node, _) }
1414
}
1515

16-
predicate hasFlow(ControlFlowNode origin, ControlFlowNode pointer) {
16+
predicate hasFlow(DataFlow::Node origin, DataFlow::Node pointer) {
1717
exists(PointsToConfiguration config, DataFlow::PathNode source, DataFlow::PathNode sink |
18-
source.getNode().asCfgNode() = origin and
19-
sink.getNode().asCfgNode() = pointer and
18+
source.getNode() = origin and
19+
sink.getNode() = pointer and
2020
config.hasFlowPath(source, sink)
2121
)
2222
}
2323

24-
from DataFlow::DataFlowCfgNode pointer, DataFlow::DataFlowCfgNode origin
24+
from DataFlow::Node pointer, DataFlow::Node origin
2525
where
2626
pointsToOrigin(pointer, origin) and
2727
not hasFlow(origin, pointer)

0 commit comments

Comments
 (0)