From b10d5cf0b0da90d1245bddda29032c574eb4541a Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Tue, 28 Sep 2021 14:49:43 +0100 Subject: [PATCH] Broaden ReturnNode to include return nodes of summaries --- ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll b/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll index a8b35da2df8..584d7eaec0e 100644 --- a/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll +++ b/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll @@ -25,10 +25,14 @@ private newtype TNode = /** Nodes intended for only use inside the data-flow libraries. */ module Private { /** A data flow node that represents returning a value from a function. */ - class ReturnNode extends Public::ResultNode { + class ReturnNode extends Node { ReturnKind kind; - ReturnNode() { kind = getReturnKind(i) } + ReturnNode() { + this.(Public::ResultNode).getIndex() = kind.getIndex() + or + this.(SummaryNode).isReturn(kind) + } /** Gets the kind of this returned value. */ ReturnKind getKind() { result = kind } @@ -66,7 +70,7 @@ module Private { } /** Holds if this summary node is a return node. */ - predicate isReturn() { FlowSummaryImpl::Private::summaryReturnNode(this, _) } + predicate isReturn(ReturnKind kind) { FlowSummaryImpl::Private::summaryReturnNode(this, kind) } /** Holds if this summary node is an out node for `call`. */ predicate isOut(DataFlowCall call) { FlowSummaryImpl::Private::summaryOutNode(call, this, _) }