From e87e543850bb5614280bfcea0d258ed740bef60c Mon Sep 17 00:00:00 2001 From: Asger F Date: Tue, 10 Sep 2024 15:02:51 +0200 Subject: [PATCH] JS: Ensure optional steps/barriers are computed in the correct stage --- .../dataflow/internal/FlowSummaryPrivate.qll | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSummaryPrivate.qll b/javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSummaryPrivate.qll index e969ab39d37..6ae42a90bd2 100644 --- a/javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSummaryPrivate.qll +++ b/javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSummaryPrivate.qll @@ -126,7 +126,7 @@ string encodeArgumentPosition(ArgumentPosition pos) { } /** Gets the return kind corresponding to specification `"ReturnValue"`. */ -ReturnKind getStandardReturnValueKind() { result = MkNormalReturnKind() } +ReturnKind getStandardReturnValueKind() { result = MkNormalReturnKind() and Stage::ref() } private module FlowSummaryStepInput implements Private::StepsInputSig { DataFlowCall getACall(SummarizedCallable sc) { @@ -238,3 +238,12 @@ ContentSet decodeUnknownWithoutContent(AccessPathSyntax::AccessPathTokenBase tok */ bindingset[token] ContentSet decodeUnknownWithContent(AccessPathSyntax::AccessPathTokenBase token) { none() } + +cached +module Stage { + cached + predicate ref() { 1 = 1 } + + cached + predicate backref() { optionalStep(_, _, _) } +}