Skip to content

Commit a4d4e40

Browse files
committed
Ruby: Summarize level steps in type tracking
1 parent 1c484d8 commit a4d4e40

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ private predicate summarizedLocalStep(Node nodeFrom, Node nodeTo) {
6262
.flowsTo(returnNode) and
6363
callStep(nodeTo.asExpr(), nodeFrom, param)
6464
)
65+
or
66+
exists(
67+
SummarizedCallable callable, DataFlowPublic::CallNode call, SummaryComponent input,
68+
SummaryComponent output
69+
|
70+
hasLevelSummary(callable, input, output) and
71+
call.asExpr().getExpr() = callable.getACallSimple() and
72+
nodeFrom = evaluateSummaryComponentLocal(call, input) and
73+
nodeTo = evaluateSummaryComponentLocal(call, output)
74+
)
6575
}
6676

6777
/** Holds if there is a level step from `nodeFrom` to `nodeTo`. */
@@ -230,6 +240,12 @@ class Boolean extends boolean {
230240

231241
private import SummaryComponentStack
232242

243+
private predicate hasLevelSummary(
244+
SummarizedCallable callable, SummaryComponent input, SummaryComponent output
245+
) {
246+
callable.propagatesFlow(singleton(input), singleton(output), true)
247+
}
248+
233249
private predicate hasStoreSummary(
234250
SummarizedCallable callable, DataFlow::ContentSet contents, SummaryComponent input,
235251
SummaryComponent output

0 commit comments

Comments
 (0)