mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Fix getAGuardedNode
This commit is contained in:
@@ -130,7 +130,7 @@ module EssaFlow {
|
||||
}
|
||||
|
||||
predicate useToNextUse(NameNode nodeFrom, NameNode nodeTo) {
|
||||
AdjacentUses::adjacentUseUseSameVar(nodeFrom, nodeTo)
|
||||
AdjacentUses::adjacentUseUse(nodeFrom, nodeTo)
|
||||
}
|
||||
|
||||
predicate defToFirstUse(EssaVariable var, NameNode nodeTo) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
private import python
|
||||
private import DataFlowPrivate
|
||||
import experimental.dataflow.TypeTracker
|
||||
private import semmle.python.essa.SsaCompute
|
||||
|
||||
/**
|
||||
* IPA type for data flow nodes.
|
||||
@@ -176,10 +177,10 @@ class BarrierGuard extends GuardNode {
|
||||
|
||||
/** Gets a node guarded by this guard. */
|
||||
final ExprNode getAGuardedNode() {
|
||||
exists(Variable v, NameNode n, boolean testIsTrue |
|
||||
n.uses(v) and
|
||||
this.checks(n, testIsTrue) and
|
||||
result.asCfgNode().(NameNode).uses(v) and
|
||||
exists(EssaDefinition def, ControlFlowNode node, boolean testIsTrue |
|
||||
AdjacentUses::aUse(def, node) and
|
||||
this.checks(node, testIsTrue) and
|
||||
AdjacentUses::aUse(def, result.asCfgNode()) and
|
||||
this.controlsNode(result.asCfgNode(), testIsTrue)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user