Skip to content

Commit d7790fa

Browse files
committed
Address review comments
1 parent 0e0b73a commit d7790fa

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

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

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,9 @@ module MakeImpl<InputSig Lang> {
480480
/**
481481
* Holds if field flow should be used for the given configuration.
482482
*/
483-
private predicate useFieldFlow() { Config::fieldFlowBranchLimit() >= 1 }
483+
private predicate useFieldFlow() {
484+
Config::fieldFlowBranchLimit() >= 1 and Config::accessPathLimit() > 0
485+
}
484486

485487
private predicate hasSourceCallCtx() {
486488
exists(FlowFeature feature | feature = Config::getAFeature() |
@@ -1331,15 +1333,6 @@ module MakeImpl<InputSig Lang> {
13311333
fwdFlow1(_, _, _, _, _, _, t0, t, ap, _) and t0 != t
13321334
}
13331335

1334-
bindingset[c, t, tail]
1335-
additional Ap apCons(Content c, Typ t, Ap tail) {
1336-
result = Param::apCons(c, t, tail) and
1337-
exists(int limit |
1338-
limit = Config::accessPathLimit() and
1339-
if tail instanceof ApNil then limit > 0 else limit > 1
1340-
)
1341-
}
1342-
13431336
pragma[nomagic]
13441337
private predicate fwdFlow0(
13451338
NodeEx node, FlowState state, Cc cc, ParamNodeOption summaryCtx, TypOption argT,
@@ -2534,7 +2527,10 @@ module MakeImpl<InputSig Lang> {
25342527

25352528
bindingset[c, t, tail]
25362529
Ap apCons(Content c, Typ t, Ap tail) {
2537-
result = true and exists(c) and exists(t) and exists(tail)
2530+
result = true and
2531+
exists(c) and
2532+
exists(t) and
2533+
if tail = true then Config::accessPathLimit() > 1 else any()
25382534
}
25392535

25402536
class ApHeadContent = Unit;
@@ -3201,10 +3197,7 @@ module MakeImpl<InputSig Lang> {
32013197
Typ getTyp(DataFlowType t) { result = t }
32023198

32033199
bindingset[c, t, tail]
3204-
Ap apCons(Content c, Typ t, Ap tail) {
3205-
result.isCons(c, t, tail) and
3206-
Config::accessPathLimit() > tail.len()
3207-
}
3200+
Ap apCons(Content c, Typ t, Ap tail) { result.isCons(c, t, tail) }
32083201

32093202
class ApHeadContent = Content;
32103203

@@ -4641,7 +4634,7 @@ module MakeImpl<InputSig Lang> {
46414634

46424635
private newtype TPartialAccessPath =
46434636
TPartialNil() or
4644-
TPartialCons(Content c, int len) { len in [1 .. accessPathLimit()] }
4637+
TPartialCons(Content c, int len) { len in [1 .. Config::accessPathLimit()] }
46454638

46464639
/**
46474640
* Conceptually a list of `Content`s, but only the first

0 commit comments

Comments
 (0)