Skip to content

Commit 0644878

Browse files
authored
Merge pull request #242 from microsoft/powershell-guardpredicate-fix
added hasbranchedge
2 parents 8ef818c + 0d11efc commit 0644878

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.github/workflows/sync-main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@ jobs:
8888
fi
8989
env:
9090
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
91+

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,21 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
278278
* guard to `branch`.
279279
*/
280280
predicate controlsBranchEdge(SsaInput::BasicBlock bb1, SsaInput::BasicBlock bb2, boolean branch) {
281+
hasBranchEdge(bb1, bb2, branch)
282+
}
283+
/**
284+
* Holds if the evaluation of this guard to `branch` corresponds to the edge
285+
* from `bb1` to `bb2`.
286+
*/
287+
predicate hasBranchEdge(SsaInput::BasicBlock bb1, SsaInput::BasicBlock bb2, boolean branch) {
281288
exists(Cfg::SuccessorTypes::ConditionalSuccessor s |
282289
this.getBasicBlock() = bb1 and
283290
bb2 = bb1.getASuccessor(s) and
284291
s.getValue() = branch
285292
)
286293
}
294+
295+
287296
}
288297

289298
/** Holds if the guard `guard` controls block `bb` upon evaluating to `branch`. */

0 commit comments

Comments
 (0)