Skip to content

Commit eac53d4

Browse files
committed
Data flow: Allow for reflexivity in localFlowStepPlus
1 parent f75615b commit eac53d4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,8 +2743,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
27432743
localFlowEntry(node1, pragma[only_bind_into](state), pragma[only_bind_into](ap)) and
27442744
preservesValue = preservesValue2 and
27452745
label = label2 and
2746-
t = t2 and
2747-
node1 != node2
2746+
t = t2
27482747
or
27492748
exists(boolean preservesValue1, DataFlowType t1, string label1 |
27502749
localFlowStepPlus(node1, pragma[only_bind_into](state), mid, preservesValue1, t1,
@@ -3565,6 +3564,18 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
35653564
}
35663565
}
35673566

3567+
private int getNumberOfTuples(NodeEx n) {
3568+
result =
3569+
count(FlowState state, ReturnCtx returnCtx, ApOption retAp, Ap ap |
3570+
revFlow(n, state, returnCtx, retAp, ap)
3571+
)
3572+
}
3573+
3574+
additional predicate maxTuples(NodeEx n, int tuples) {
3575+
tuples = getNumberOfTuples(n) and
3576+
tuples = max(getNumberOfTuples(_))
3577+
}
3578+
35683579
additional predicate stats(
35693580
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, int calledges,
35703581
int tfnodes, int tftuples
@@ -4762,6 +4773,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
47624773
Stage5::stats(false, nodes, fields, conscand, states, tuples, calledges, tfnodes, tftuples)
47634774
}
47644775

4776+
predicate maxTuplesStage5 = Stage5::maxTuples/2;
4777+
47654778
predicate stageStats(
47664779
int n, string stage, int nodes, int fields, int conscand, int states, int tuples,
47674780
int calledges, int tfnodes, int tftuples

0 commit comments

Comments
 (0)