Skip to content

Commit 44c6717

Browse files
committed
Python: Fix default parameter value flow
Somehow the previous fix didn't work :O
1 parent 43b0250 commit 44c6717

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,10 @@ predicate runtimeJumpStep(Node nodeFrom, Node nodeTo) {
467467
// a parameter with a default value, since the parameter will be in the scope of the
468468
// function, while the default value itself will be in the scope that _defines_ the
469469
// function.
470-
nodeFrom.(CfgNode).getNode() =
471-
nodeTo.(EssaNode).getVar().getDefinition().(ParameterDefinition).getDefault()
470+
exists(ParameterDefinition param |
471+
nodeFrom.asCfgNode() = param.getDefault() and
472+
nodeTo.asCfgNode() = param.getDefiningNode()
473+
)
472474
}
473475

474476
/**

python/ql/test/library-tests/PointsTo/new/ImpliesDataflow.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
| code/h_classes.py:3:1:3:16 | ControlFlowNode for ClassExpr | code/h_classes.py:10:1:10:9 | ControlFlowNode for type() |
22
| code/h_classes.py:3:1:3:16 | ControlFlowNode for ClassExpr | code/h_classes.py:15:5:15:13 | ControlFlowNode for type() |
3-
| code/l_calls.py:3:13:3:14 | ControlFlowNode for List | code/l_calls.py:4:12:4:12 | ControlFlowNode for x |
4-
| code/l_calls.py:6:13:6:14 | ControlFlowNode for List | code/l_calls.py:7:16:7:16 | ControlFlowNode for x |
53
| code/l_calls.py:12:1:12:20 | ControlFlowNode for ClassExpr | code/l_calls.py:16:16:16:18 | ControlFlowNode for cls |
64
| code/l_calls.py:12:1:12:20 | ControlFlowNode for ClassExpr | code/l_calls.py:24:13:24:22 | ControlFlowNode for Attribute() |
75
| code/l_calls.py:12:1:12:20 | ControlFlowNode for ClassExpr | code/l_calls.py:25:16:25:16 | ControlFlowNode for a |

0 commit comments

Comments
 (0)