Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
smowton committed Aug 15, 2024
1 parent 7cedf68 commit 99f9444
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,11 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
}

pragma[noinline]
private predicate guardsNode(Node g, ControlFlow::ConditionGuardNode guard, Node arg, Node ret) {
guards(g, guard, arg) and
guard.dominates(ret.getBasicBlock())
private predicate guardsNode(Node g, Node arg, Node ret) {
exists(ControlFlow::ConditionGuardNode guard |
guards(g, guard, arg) and
guard.dominates(ret.getBasicBlock())
)
}

/**
Expand All @@ -363,7 +365,8 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
ret = outp.getEntryNode(fd) and
(
// Case: a function like "if someBarrierGuard(arg) { return true } else { return false }"
exists(ControlFlow::ConditionGuardNode guard | guardsNode(g, guard, arg, ret) |
guardsNode(g, arg, ret) and
(
exists(boolean b |
onlyPossibleReturnOfBool(fd, outp, ret, b) and
p.isBoolean(b)
Expand Down

0 comments on commit 99f9444

Please sign in to comment.