Skip to content

Commit 967a210

Browse files
committed
PS: Fix two bad joins.
1 parent c76571c commit 967a210

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

powershell/ql/lib/semmle/code/powershell/controlflow/CfgNodes.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ class StmtCfgNode extends AstCfgNode {
6262
Stmt getStmt() { result = s }
6363
}
6464

65+
pragma[nomagic]
66+
private BasicBlock getARelevantBasicBlock(Ast a) { result.getANode().getAstNode() = a }
67+
6568
/**
6669
* A class for mapping parent-child AST nodes to parent-child CFG nodes.
6770
*/
@@ -86,7 +89,7 @@ abstract private class ChildMapping extends Ast {
8689
or
8790
exists(BasicBlock mid |
8891
this.reachesBasicBlock(child, cfn, mid) and
89-
not mid.getANode().getAstNode() = child
92+
not mid = getARelevantBasicBlock(child)
9093
|
9194
if this.precedesParent(child) then bb = mid.getAPredecessor() else bb = mid.getASuccessor()
9295
)

powershell/ql/lib/semmle/code/powershell/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,11 +1083,8 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
10831083
)
10841084
or
10851085
// Read from a collection into a `foreach` loop
1086-
exists(
1087-
CfgNodes::StmtNodes::ForEachStmtCfgNode forEach, Content::KnownElementContent ec, BasicBlock bb,
1088-
int i
1089-
|
1090-
c.isKnownOrUnknownElement(ec) and
1086+
c.isAnyPositional() and
1087+
exists(CfgNodes::StmtNodes::ForEachStmtCfgNode forEach, BasicBlock bb, int i |
10911088
node1.asExpr() = forEach.getIterableExpr() and
10921089
bb.getNode(i) = forEach.getVarAccess() and
10931090
node2.asDefinition().definesAt(_, bb, i)

0 commit comments

Comments
 (0)