Skip to content

Commit bbdae51

Browse files
committed
Dataflow: Add ArgNodeEx column to fwdFlowIsEntered.
1 parent fa13861 commit bbdae51

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

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

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,22 +1776,20 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
17761776

17771777
pragma[inline]
17781778
predicate fwdFlowIn(
1779-
DataFlowCall call, DataFlowCallable inner, ParamNodeEx p, FlowState state, Cc outercc,
1780-
CcCall innercc, ParamNodeOption summaryCtx, TypOption argT, ApOption argAp, Typ t,
1781-
Ap ap, ApApprox apa, boolean cc, boolean allowsFlowThrough
1779+
DataFlowCall call, ArgNodeEx arg, DataFlowCallable inner, ParamNodeEx p,
1780+
FlowState state, Cc outercc, CcCall innercc, ParamNodeOption summaryCtx, TypOption argT,
1781+
ApOption argAp, Typ t, Ap ap, ApApprox apa, boolean cc, boolean allowsFlowThrough
17821782
) {
1783-
exists(ArgNodeEx arg |
1784-
// type flow disabled: linear recursion
1785-
fwdFlowInCandTypeFlowDisabled(call, arg, state, outercc, inner, p, summaryCtx, argT,
1786-
argAp, t, ap, apa, cc, allowsFlowThrough) and
1787-
fwdFlowInValidEdgeTypeFlowDisabled(call, inner, innercc, pragma[only_bind_into](cc))
1788-
or
1789-
// type flow enabled: non-linear recursion
1790-
exists(boolean emptyAp |
1791-
fwdFlowIntoArg(arg, state, outercc, summaryCtx, argT, argAp, t, ap, emptyAp, apa, cc) and
1792-
fwdFlowInValidEdgeTypeFlowEnabled(call, arg, outercc, inner, p, innercc, emptyAp,
1793-
apa, cc, allowsFlowThrough)
1794-
)
1783+
// type flow disabled: linear recursion
1784+
fwdFlowInCandTypeFlowDisabled(call, arg, state, outercc, inner, p, summaryCtx, argT,
1785+
argAp, t, ap, apa, cc, allowsFlowThrough) and
1786+
fwdFlowInValidEdgeTypeFlowDisabled(call, inner, innercc, pragma[only_bind_into](cc))
1787+
or
1788+
// type flow enabled: non-linear recursion
1789+
exists(boolean emptyAp |
1790+
fwdFlowIntoArg(arg, state, outercc, summaryCtx, argT, argAp, t, ap, emptyAp, apa, cc) and
1791+
fwdFlowInValidEdgeTypeFlowEnabled(call, arg, outercc, inner, p, innercc, emptyAp, apa,
1792+
cc, allowsFlowThrough)
17951793
)
17961794
}
17971795
}
@@ -1804,8 +1802,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
18041802
boolean allowsFlowThrough
18051803
) {
18061804
exists(boolean allowsFlowThrough0 |
1807-
FwdFlowIn<FwdFlowInNoRestriction>::fwdFlowIn(_, _, p, state, _, innercc, _, _, _, t, ap,
1808-
apa, _, allowsFlowThrough0) and
1805+
FwdFlowIn<FwdFlowInNoRestriction>::fwdFlowIn(_, _, _, p, state, _, innercc, _, _, _, t,
1806+
ap, apa, _, allowsFlowThrough0) and
18091807
if PrevStage::parameterMayFlowThrough(p, apa)
18101808
then allowsFlowThrough = allowsFlowThrough0
18111809
else allowsFlowThrough = false
@@ -1907,8 +1905,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
19071905
DataFlowCall call, DataFlowCallable c, ParamNodeEx p, FlowState state, CcCall innercc,
19081906
Typ t, Ap ap, boolean cc
19091907
) {
1910-
FwdFlowIn<FwdFlowInNoRestriction>::fwdFlowIn(call, c, p, state, _, innercc, _, _, _, t,
1911-
ap, _, cc, _)
1908+
FwdFlowIn<FwdFlowInNoRestriction>::fwdFlowIn(call, _, c, p, state, _, innercc, _, _, _,
1909+
t, ap, _, cc, _)
19121910
}
19131911

19141912
pragma[nomagic]
@@ -1993,13 +1991,14 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
19931991

19941992
pragma[inline]
19951993
private predicate fwdFlowThrough0(
1996-
DataFlowCall call, Cc cc, FlowState state, CcCall ccc, ParamNodeOption summaryCtx,
1997-
TypOption argT, ApOption argAp, Typ t, Ap ap, ApApprox apa, RetNodeEx ret,
1998-
ParamNodeEx innerSummaryCtx, Typ innerArgT, Ap innerArgAp, ApApprox innerArgApa
1994+
DataFlowCall call, ArgNodeEx arg, Cc cc, FlowState state, CcCall ccc,
1995+
ParamNodeOption summaryCtx, TypOption argT, ApOption argAp, Typ t, Ap ap, ApApprox apa,
1996+
RetNodeEx ret, ParamNodeEx innerSummaryCtx, Typ innerArgT, Ap innerArgAp,
1997+
ApApprox innerArgApa
19991998
) {
20001999
fwdFlowRetFromArg(ret, state, ccc, innerSummaryCtx, innerArgT, innerArgAp, innerArgApa, t,
20012000
ap, apa) and
2002-
fwdFlowIsEntered(call, cc, ccc, summaryCtx, argT, argAp, innerSummaryCtx, innerArgT,
2001+
fwdFlowIsEntered(call, arg, cc, ccc, summaryCtx, argT, argAp, innerSummaryCtx, innerArgT,
20032002
innerArgAp)
20042003
}
20052004

@@ -2009,8 +2008,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
20092008
TypOption argT, ApOption argAp, Typ t, Ap ap, ApApprox apa, RetNodeEx ret,
20102009
ApApprox innerArgApa
20112010
) {
2012-
fwdFlowThrough0(call, cc, state, ccc, summaryCtx, argT, argAp, t, ap, apa, ret, _, _, _,
2013-
innerArgApa)
2011+
fwdFlowThrough0(call, _, cc, state, ccc, summaryCtx, argT, argAp, t, ap, apa, ret, _, _,
2012+
_, innerArgApa)
20142013
}
20152014

20162015
private module FwdFlowThroughRestriction implements FwdFlowInInputSig {
@@ -2025,11 +2024,11 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
20252024
*/
20262025
pragma[nomagic]
20272026
private predicate fwdFlowIsEntered(
2028-
DataFlowCall call, Cc cc, CcCall innerCc, ParamNodeOption summaryCtx, TypOption argT,
2029-
ApOption argAp, ParamNodeEx p, Typ t, Ap ap
2027+
DataFlowCall call, ArgNodeEx arg, Cc cc, CcCall innerCc, ParamNodeOption summaryCtx,
2028+
TypOption argT, ApOption argAp, ParamNodeEx p, Typ t, Ap ap
20302029
) {
2031-
FwdFlowIn<FwdFlowThroughRestriction>::fwdFlowIn(call, _, p, _, cc, innerCc, summaryCtx,
2032-
argT, argAp, t, ap, _, _, true)
2030+
FwdFlowIn<FwdFlowThroughRestriction>::fwdFlowIn(call, arg, _, p, _, cc, innerCc,
2031+
summaryCtx, argT, argAp, t, ap, _, _, true)
20332032
}
20342033

20352034
pragma[nomagic]
@@ -2052,8 +2051,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
20522051
DataFlowCall call, FlowState state, CcCall ccc, Ap ap, ApApprox apa, RetNodeEx ret,
20532052
ParamNodeEx innerSummaryCtx, Typ innerArgT, Ap innerArgAp, ApApprox innerArgApa
20542053
) {
2055-
fwdFlowThrough0(call, _, state, ccc, _, _, _, _, ap, apa, ret, innerSummaryCtx, innerArgT,
2056-
innerArgAp, innerArgApa)
2054+
fwdFlowThrough0(call, _, _, state, ccc, _, _, _, _, ap, apa, ret, innerSummaryCtx,
2055+
innerArgT, innerArgAp, innerArgApa)
20572056
}
20582057

20592058
pragma[nomagic]

0 commit comments

Comments
 (0)