Skip to content

Commit c4d267c

Browse files
committed
Dataflow: wip test: adjust count (block less) and adjust return edge cond (block more)
1 parent 71f8ccf commit c4d267c

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

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

+14-7
Original file line numberDiff line numberDiff line change
@@ -1084,9 +1084,12 @@ module MakeImpl<InputSig Lang> {
10841084
pragma[nomagic]
10851085
private int branch(NodeEx n1) {
10861086
result =
1087-
strictcount(NodeEx n |
1088-
flowOutOfCallNodeCand1(_, n1, _, n) or flowIntoCallNodeCand1(_, n1, n)
1087+
strictcount(DataFlowCallable c | exists(NodeEx n |
1088+
flowOutOfCallNodeCand1(_, n1, _, n) or flowIntoCallNodeCand1(_, n1, n) | c = n.getEnclosingCallable())
10891089
) + sum(ParamNodeEx p1 | | getLanguageSpecificFlowIntoCallNodeCand1(n1, p1))
1090+
// strictcount(NodeEx n |
1091+
// flowOutOfCallNodeCand1(_, n1, _, n) or flowIntoCallNodeCand1(_, n1, n)
1092+
// ) + sum(ParamNodeEx p1 | | getLanguageSpecificFlowIntoCallNodeCand1(n1, p1))
10901093
}
10911094

10921095
/**
@@ -1097,9 +1100,12 @@ module MakeImpl<InputSig Lang> {
10971100
pragma[nomagic]
10981101
private int join(NodeEx n2) {
10991102
result =
1100-
strictcount(NodeEx n |
1101-
flowOutOfCallNodeCand1(_, n, _, n2) or flowIntoCallNodeCand1(_, n, n2)
1103+
strictcount(DataFlowCallable c | exists(NodeEx n |
1104+
flowOutOfCallNodeCand1(_, n, _, n2) or flowIntoCallNodeCand1(_, n, n2) | c = n.getEnclosingCallable())
11021105
) + sum(ArgNodeEx arg2 | | getLanguageSpecificFlowIntoCallNodeCand1(arg2, n2))
1106+
// strictcount(NodeEx n |
1107+
// flowOutOfCallNodeCand1(_, n, _, n2) or flowIntoCallNodeCand1(_, n, n2)
1108+
// ) + sum(ArgNodeEx arg2 | | getLanguageSpecificFlowIntoCallNodeCand1(arg2, n2))
11031109
}
11041110

11051111
/**
@@ -1114,10 +1120,11 @@ module MakeImpl<InputSig Lang> {
11141120
DataFlowCall call, RetNodeEx ret, ReturnKindExt kind, NodeEx out, boolean allowsFieldFlow
11151121
) {
11161122
flowOutOfCallNodeCand1(call, ret, kind, out) and
1117-
exists(int b, int j |
1118-
b = branch(ret) and
1123+
exists(int j | //b, int j |
1124+
// b = branch(ret) and
11191125
j = join(out) and
1120-
if b.minimum(j) <= Config::fieldFlowBranchLimit()
1126+
// if b.minimum(j) <= Config::fieldFlowBranchLimit()
1127+
if j <= Config::fieldFlowBranchLimit()
11211128
then allowsFieldFlow = true
11221129
else allowsFieldFlow = false
11231130
)

0 commit comments

Comments
 (0)