Skip to content

Commit 224a2c3

Browse files
authored
Merge pull request github#13231 from hvitved/ruby/type-tracker-missing-callback-flow-out
Ruby: Allow for flow through callbacks to summarized methods in type tracking
2 parents 58f4b76 + 128168a commit 224a2c3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ruby/ql/lib/codeql/ruby/typetracking/TypeTrackerSpecific.qll

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,17 @@ private DataFlow::Node evaluateSummaryComponentStackLocal(
598598
pragma[only_bind_out](tail)) and
599599
stack = SCS::push(pragma[only_bind_out](head), pragma[only_bind_out](tail))
600600
|
601-
exists(DataFlowDispatch::ArgumentPosition apos, DataFlowDispatch::ParameterPosition ppos |
601+
exists(
602+
DataFlowDispatch::ArgumentPosition apos, DataFlowDispatch::ParameterPosition ppos,
603+
DataFlowPrivate::ParameterNodeImpl p
604+
|
602605
head = SummaryComponent::parameter(apos) and
603606
DataFlowDispatch::parameterMatch(ppos, apos) and
604-
result.(DataFlowPrivate::ParameterNodeImpl).isSourceParameterOf(prev.asExpr().getExpr(), ppos)
607+
p.isSourceParameterOf(prev.asExpr().getExpr(), ppos) and
608+
// We need to include both `p` and the SSA definition for `p`, since in type-tracking
609+
// the step from `p` to the SSA definition is considered a call step.
610+
result =
611+
[p.(DataFlow::Node), DataFlowPrivate::LocalFlow::getParameterDefNode(p.getParameter())]
605612
)
606613
or
607614
head = SummaryComponent::return() and

0 commit comments

Comments
 (0)