Skip to content

Commit 4205453

Browse files
committed
Dataflow: Minor review fixes.
1 parent b13d026 commit 4205453

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,7 @@ module MakeImpl<InputSig Lang> {
17251725
pos = ret.getReturnPosition() and
17261726
if allowsFieldFlow = false then ap instanceof ApNil else any()
17271727
|
1728+
// both directions are needed for flow-through
17281729
FwdTypeFlowInput::dataFlowTakenCallEdgeIn(call, c, _) or
17291730
FwdTypeFlowInput::dataFlowTakenCallEdgeOut(call, c)
17301731
)
@@ -1894,13 +1895,15 @@ module MakeImpl<InputSig Lang> {
18941895

18951896
private module RevTypeFlow = TypeFlow<RevTypeFlowInput>;
18961897

1898+
pragma[nomagic]
18971899
private predicate flowIntoCallApValid(
18981900
DataFlowCall call, DataFlowCallable c, ArgNodeEx arg, ParamNodeEx p, Ap ap
18991901
) {
19001902
flowIntoCallAp(call, c, arg, p, ap) and
19011903
RevTypeFlow::typeFlowValidEdgeOut(call, c)
19021904
}
19031905

1906+
pragma[nomagic]
19041907
private predicate flowOutOfCallApValid(
19051908
DataFlowCall call, RetNodeEx ret, ReturnPosition pos, NodeEx out, Ap ap, boolean cc
19061909
) {
@@ -2071,8 +2074,12 @@ module MakeImpl<InputSig Lang> {
20712074
flowIntoCallAp(call, c, arg, p, ap) and
20722075
revFlow(arg, pragma[only_bind_into](state), pragma[only_bind_into](ap)) and
20732076
revFlow(p, pragma[only_bind_into](state), pragma[only_bind_into](ap)) and
2077+
// allowsFieldFlow has already been checked in flowIntoCallAp, since
2078+
// `Ap` is at least as precise as a boolean from Stage 2 and
2079+
// forward, so no need to check it again later.
20742080
allowsFieldFlow = true
20752081
|
2082+
// both directions are needed for flow-through
20762083
RevTypeFlowInput::dataFlowTakenCallEdgeIn(call, c, _) or
20772084
RevTypeFlowInput::dataFlowTakenCallEdgeOut(call, c)
20782085
)

0 commit comments

Comments
 (0)