mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #5007 from yoff/python-disregard-comp-args
This commit is contained in:
@@ -179,7 +179,12 @@ ExprNode exprNode(DataFlowExpr e) { result.getNode().getNode() = e }
|
||||
class ParameterNode extends CfgNode {
|
||||
ParameterDefinition def;
|
||||
|
||||
ParameterNode() { node = def.getDefiningNode() }
|
||||
ParameterNode() {
|
||||
node = def.getDefiningNode() and
|
||||
// Disregard parameters that we cannot resolve
|
||||
// TODO: Make this unnecessary
|
||||
exists(DataFlowCallable c | node = c.getParameter(_))
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this node is the parameter of callable `c` at the
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
uniqueEnclosingCallable
|
||||
| test.py:239:27:239:27 | ControlFlowNode for p | Node should have one enclosing callable but has 0. |
|
||||
uniqueType
|
||||
uniqueNodeLocation
|
||||
missingLocation
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| test.py:239:27:239:27 | Parameter | There is no `ParameterNode` associated with this parameter. |
|
||||
@@ -0,0 +1,7 @@
|
||||
import python
|
||||
import semmle.python.dataflow.new.DataFlow
|
||||
|
||||
query predicate parameterWithoutNode(Parameter p, string msg) {
|
||||
not exists(DataFlow::ParameterNode node | p = node.getParameter()) and
|
||||
msg = "There is no `ParameterNode` associated with this parameter."
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
| test.py:187:1:187:53 | GSSA Variable SINK | test.py:189:5:189:8 | ControlFlowNode for SINK |
|
||||
| test.py:187:1:187:53 | GSSA Variable SOURCE | test.py:188:25:188:30 | ControlFlowNode for SOURCE |
|
||||
| test.py:188:5:188:5 | SSA variable x | test.py:189:10:189:10 | ControlFlowNode for x |
|
||||
| test.py:188:9:188:68 | ControlFlowNode for .0 | test.py:188:9:188:68 | SSA variable .0 |
|
||||
| test.py:188:9:188:68 | ControlFlowNode for ListComp | test.py:188:5:188:5 | SSA variable x |
|
||||
| test.py:188:9:188:68 | SSA variable .0 | test.py:188:9:188:68 | ControlFlowNode for .0 |
|
||||
| test.py:188:16:188:16 | SSA variable v | test.py:188:45:188:45 | ControlFlowNode for v |
|
||||
|
||||
Reference in New Issue
Block a user