Skip to content

Commit 891b2b8

Browse files
committed
DataFlow: Support a bare Argument[n] as a valid output stack
1 parent 8fab235 commit 891b2b8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

shared/dataflow/codeql/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,7 @@ module Make<
565565
isLocalSummaryComponent(s.head())
566566
}
567567

568-
/** Like `isSupportedInputStack` but for output stacks. */
569-
private predicate isSupportedOutputStack(SummaryComponentStack s) {
568+
private predicate isSupportedOutputStack1(SummaryComponentStack s) {
570569
// ReturnValue.*
571570
s.length() = 1 and
572571
s.head() instanceof TReturnSummaryComponent
@@ -581,10 +580,19 @@ module Make<
581580
s.head() instanceof TParameterSummaryComponent and
582581
s.tail().head() instanceof TArgumentSummaryComponent
583582
or
584-
isSupportedOutputStack(s.tail()) and
583+
isSupportedOutputStack1(s.tail()) and
585584
isLocalSummaryComponent(s.head())
586585
}
587586

587+
/** Like `isSupportedInputStack` but for output stacks. */
588+
private predicate isSupportedOutputStack(SummaryComponentStack s) {
589+
isSupportedOutputStack1(s)
590+
or
591+
// `Argument[n]` not followed by anything. Needs to be outside the recursion.
592+
s.length() = 1 and
593+
s.head() instanceof TArgumentSummaryComponent
594+
}
595+
588596
/**
589597
* Holds if `callable` has an unsupported flow `input -> output`.
590598
*

0 commit comments

Comments
 (0)