Skip to content

Commit ebee35b

Browse files
committed
Ruby: No fieldFlowBranchLimit for SummarizedCallables
1 parent 8bbfb82 commit ebee35b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ module RubyDataFlow implements InputSig {
3131
predicate mayBenefitFromCallContext = Private::mayBenefitFromCallContext/1;
3232

3333
predicate viableImplInCallContext = Private::viableImplInCallContext/2;
34+
35+
predicate ignoreFieldFlowBranchLimit(DataFlowCallable c) { exists(c.asLibraryCallable()) }
3436
}

shared/dataflow/codeql/dataflow/DataFlow.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ signature module InputSig {
273273
) {
274274
any()
275275
}
276+
277+
/** Holds if `fieldFlowBranchLimit` should be ignored for flow going into/out of `c`. */
278+
default predicate ignoreFieldFlowBranchLimit(DataFlowCallable c) { none() }
276279
}
277280

278281
module Configs<InputSig Lang> {

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,9 @@ module MakeImpl<InputSig Lang> {
11171117
exists(int b, int j |
11181118
b = branch(ret) and
11191119
j = join(out) and
1120-
if b.minimum(j) <= Config::fieldFlowBranchLimit()
1120+
if
1121+
b.minimum(j) <= Config::fieldFlowBranchLimit() or
1122+
ignoreFieldFlowBranchLimit(ret.getEnclosingCallable())
11211123
then allowsFieldFlow = true
11221124
else allowsFieldFlow = false
11231125
)
@@ -1136,7 +1138,9 @@ module MakeImpl<InputSig Lang> {
11361138
exists(int b, int j |
11371139
b = branch(arg) and
11381140
j = join(p) and
1139-
if b.minimum(j) <= Config::fieldFlowBranchLimit()
1141+
if
1142+
b.minimum(j) <= Config::fieldFlowBranchLimit() or
1143+
ignoreFieldFlowBranchLimit(p.getEnclosingCallable())
11401144
then allowsFieldFlow = true
11411145
else allowsFieldFlow = false
11421146
)

0 commit comments

Comments
 (0)