From 99f9444f57959d291210e31623c13d5380e3d822 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 15 Aug 2024 15:05:20 +0100 Subject: [PATCH] Cleanup --- .../lib/semmle/go/dataflow/internal/DataFlowUtil.qll | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll b/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll index bff1f996806e..1cb89d108890 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll @@ -340,9 +340,11 @@ module BarrierGuard { } 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()) + ) } /** @@ -363,7 +365,8 @@ module BarrierGuard { 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)