Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff02ba5

Browse files
committed
Ruby: include SSA param input step for flowsTo
1 parent 0171578 commit ff02ba5

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,12 @@ private module Cached {
327327
FlowSummaryImpl::Private::Steps::summaryThroughStepValue(nodeFrom, nodeTo, _)
328328
}
329329

330-
/** This is the local flow predicate that is used in type tracking. */
330+
/**
331+
* This is the local flow predicate that is used in type tracking.
332+
*
333+
* This needs to exclude `localFlowSsaParamInput` due to a performance trick
334+
* in type tracking, where such steps are treated as call steps.
335+
*/
331336
cached
332337
predicate localFlowStepTypeTracker(Node nodeFrom, Node nodeTo) {
333338
LocalFlow::localFlowStepCommon(nodeFrom, nodeTo)

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPublic.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,11 @@ private module Cached {
326326
source = sink and
327327
source instanceof LocalSourceNode
328328
or
329-
exists(Node mid |
330-
hasLocalSource(mid, source) and
329+
exists(Node mid | hasLocalSource(mid, source) |
331330
localFlowStepTypeTracker(mid, sink)
331+
or
332+
// Explicitly include the SSA param input step as type-tracking omits this step.
333+
LocalFlow::localFlowSsaParamInput(mid, sink)
332334
)
333335
}
334336

0 commit comments

Comments
 (0)