Skip to content

Commit 1ea39dd

Browse files
committed
Fix bad join order in getANonTestPassingReachingNodeRecursive
1 parent 6727aba commit 1ea39dd

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

go/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,10 @@ private predicate isPossibleInputNode(DataFlow::Node inputNode, FuncDef fd) {
336336
* an expression which data flows to from `inputNode`.
337337
*/
338338
private ControlFlow::Node getANonTestPassingPredecessor(
339-
ControlFlow::Node succ, DataFlow::Node inputNode
339+
ControlFlow::Node succ, DataFlow::Node inputNode, FuncDef fd
340340
) {
341-
isPossibleInputNode(inputNode, succ.getRoot()) and
341+
succ.getRoot() = fd and
342+
isPossibleInputNode(inputNode, fd) and
342343
result = succ.getAPredecessor() and
343344
not exists(DataFlow::Node switchExprNode |
344345
flowsToSwitchExpression(inputNode, switchExprNode) and
@@ -360,13 +361,15 @@ private ControlFlow::Node getANonTestPassingPredecessor(
360361
}
361362

362363
private ControlFlow::Node getANonTestPassingReachingNodeRecursive(
363-
ControlFlow::Node n, DataFlow::Node inputNode
364+
ControlFlow::Node n, DataFlow::Node inputNode, FuncDef fd
364365
) {
365-
isPossibleInputNode(inputNode, n.getRoot()) and
366+
n.getRoot() = fd and
367+
isPossibleInputNode(inputNode, fd) and
366368
(
367369
result = n or
368370
result =
369-
getANonTestPassingReachingNodeRecursive(getANonTestPassingPredecessor(n, inputNode), inputNode)
371+
getANonTestPassingReachingNodeRecursive(getANonTestPassingPredecessor(n, inputNode, fd),
372+
inputNode, fd)
370373
)
371374
}
372375

@@ -378,7 +381,7 @@ private ControlFlow::Node getANonTestPassingReachingNodeRecursive(
378381
private ControlFlow::Node getANonTestPassingReachingNodeBase(
379382
IR::ReturnInstruction ret, DataFlow::Node inputNode
380383
) {
381-
result = getANonTestPassingReachingNodeRecursive(ret, inputNode)
384+
result = getANonTestPassingReachingNodeRecursive(ret, inputNode, ret.getRoot())
382385
}
383386

384387
/**

0 commit comments

Comments
 (0)