Skip to content

Commit c50b0c6

Browse files
committed
PS: Prevent join on boolean.
1 parent a38d57f commit c50b0c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

powershell/ql/lib/semmle/code/powershell/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,15 +427,17 @@ module Trees {
427427
override predicate last(AstNode last, Completion c) {
428428
// Exit the loop body when the condition is false
429429
last(this.getCondition(), last, c) and
430-
this.entersLoopWhenConditionIs(c.(BooleanCompletion).getValue().booleanNot())
430+
this.entersLoopWhenConditionIs(pragma[only_bind_into](c.(BooleanCompletion)
431+
.getValue()
432+
.booleanNot()))
431433
or
432434
super.last(last, c)
433435
}
434436

435437
override predicate succ(AstNode pred, AstNode succ, Completion c) {
436438
// Condition -> body
437439
last(this.getCondition(), pred, c) and
438-
this.entersLoopWhenConditionIs(c.(BooleanCompletion).getValue()) and
440+
this.entersLoopWhenConditionIs(pragma[only_bind_into](c.(BooleanCompletion).getValue())) and
439441
first(this.getBody(), succ)
440442
or
441443
// Body -> condition

0 commit comments

Comments
 (0)