Skip to content

Commit 22e0636

Browse files
committed
Dataflow: Insert a few getApprox calls to remove even more columns.
1 parent a77adad commit 22e0636

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,15 +1545,17 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
15451545
apa = getApprox(ap)
15461546
or
15471547
// flow into a callable without summary context
1548-
fwdFlowInNoFlowThrough(node, apa, state, cc, t, ap, stored) and
1548+
fwdFlowInNoFlowThrough(node, state, cc, t, ap, stored) and
1549+
apa = getApprox(ap) and
15491550
summaryCtx = TSummaryCtxNone() and
15501551
// When the call contexts of source and sink needs to match then there's
15511552
// never any reason to enter a callable except to find a summary. See also
15521553
// the comment in `PathNodeMid::isAtSink`.
15531554
not Config::getAFeature() instanceof FeatureEqualSourceSinkCallContext
15541555
or
15551556
// flow into a callable with summary context (non-linear recursion)
1556-
fwdFlowInFlowThrough(node, apa, state, cc, t, ap, stored) and
1557+
fwdFlowInFlowThrough(node, state, cc, t, ap, stored) and
1558+
apa = getApprox(ap) and
15571559
summaryCtx = TSummaryCtxSome(node, state, t, ap, stored)
15581560
or
15591561
// flow out of a callable
@@ -1562,8 +1564,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
15621564
or
15631565
// flow through a callable
15641566
exists(DataFlowCall call, CcCall ccc, RetNodeEx ret, boolean allowsFieldFlow |
1565-
fwdFlowThrough(call, cc, state, ccc, summaryCtx, t, ap, apa, stored, ret) and
1567+
fwdFlowThrough(call, cc, state, ccc, summaryCtx, t, ap, stored, ret) and
15661568
flowThroughOutOfCall(call, ccc, ret, node, allowsFieldFlow) and
1569+
apa = getApprox(ap) and
15671570
not inBarrier(node, state) and
15681571
if allowsFieldFlow = false then ap instanceof ApNil else any()
15691572
)
@@ -1572,7 +1575,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
15721575
private newtype TSummaryCtx =
15731576
TSummaryCtxNone() or
15741577
TSummaryCtxSome(ParamNodeEx p, FlowState state, Typ t, Ap ap, TypOption stored) {
1575-
fwdFlowInFlowThrough(p, _, state, _, t, ap, stored)
1578+
fwdFlowInFlowThrough(p, state, _, t, ap, stored)
15761579
}
15771580

15781581
/**
@@ -1823,11 +1826,10 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
18231826
pragma[inline]
18241827
private predicate fwdFlowInCandTypeFlowDisabled(
18251828
DataFlowCall call, ArgNodeEx arg, FlowState state, Cc outercc, DataFlowCallable inner,
1826-
ParamNodeEx p, SummaryCtx summaryCtx, Typ t, Ap ap, ApApprox apa, TypOption stored,
1827-
boolean cc
1829+
ParamNodeEx p, SummaryCtx summaryCtx, Typ t, Ap ap, TypOption stored, boolean cc
18281830
) {
18291831
not enableTypeFlow() and
1830-
fwdFlowInCand(call, arg, state, outercc, inner, p, summaryCtx, t, ap, _, apa, stored, cc)
1832+
fwdFlowInCand(call, arg, state, outercc, inner, p, summaryCtx, t, ap, _, _, stored, cc)
18311833
}
18321834

18331835
pragma[nomagic]
@@ -1862,15 +1864,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
18621864
predicate fwdFlowIn(
18631865
DataFlowCall call, ArgNodeEx arg, DataFlowCallable inner, ParamNodeEx p,
18641866
FlowState state, Cc outercc, CcCall innercc, SummaryCtx summaryCtx, Typ t, Ap ap,
1865-
ApApprox apa, TypOption stored, boolean cc
1867+
TypOption stored, boolean cc
18661868
) {
18671869
// type flow disabled: linear recursion
18681870
fwdFlowInCandTypeFlowDisabled(call, arg, state, outercc, inner, p, summaryCtx, t, ap,
1869-
apa, stored, cc) and
1871+
stored, cc) and
18701872
fwdFlowInValidEdgeTypeFlowDisabled(call, inner, innercc, pragma[only_bind_into](cc))
18711873
or
18721874
// type flow enabled: non-linear recursion
1873-
exists(boolean emptyAp |
1875+
exists(boolean emptyAp, ApApprox apa |
18741876
fwdFlowIntoArg(arg, state, outercc, summaryCtx, t, ap, emptyAp, apa, stored, cc) and
18751877
fwdFlowInValidEdgeTypeFlowEnabled(call, arg, outercc, inner, p, innercc, emptyAp, apa,
18761878
cc)
@@ -1884,10 +1886,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
18841886

18851887
pragma[nomagic]
18861888
private predicate fwdFlowInNoFlowThrough(
1887-
ParamNodeEx p, ApApprox apa, FlowState state, CcCall innercc, Typ t, Ap ap,
1888-
TypOption stored
1889+
ParamNodeEx p, FlowState state, CcCall innercc, Typ t, Ap ap, TypOption stored
18891890
) {
1890-
FwdFlowInNoThrough::fwdFlowIn(_, _, _, p, state, _, innercc, _, t, ap, apa, stored, _)
1891+
FwdFlowInNoThrough::fwdFlowIn(_, _, _, p, state, _, innercc, _, t, ap, stored, _)
18911892
}
18921893

18931894
private predicate top() { any() }
@@ -1896,10 +1897,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
18961897

18971898
pragma[nomagic]
18981899
private predicate fwdFlowInFlowThrough(
1899-
ParamNodeEx p, ApApprox apa, FlowState state, CcCall innercc, Typ t, Ap ap,
1900-
TypOption stored
1900+
ParamNodeEx p, FlowState state, CcCall innercc, Typ t, Ap ap, TypOption stored
19011901
) {
1902-
FwdFlowInThrough::fwdFlowIn(_, _, _, p, state, _, innercc, _, t, ap, apa, stored, _)
1902+
FwdFlowInThrough::fwdFlowIn(_, _, _, p, state, _, innercc, _, t, ap, stored, _)
19031903
}
19041904

19051905
pragma[nomagic]
@@ -1997,9 +1997,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
19971997
DataFlowCall call, DataFlowCallable c, ParamNodeEx p, FlowState state, CcCall innercc,
19981998
Typ t, Ap ap, TypOption stored, boolean cc
19991999
) {
2000-
FwdFlowInNoThrough::fwdFlowIn(call, _, c, p, state, _, innercc, _, t, ap, _, stored, cc)
2000+
FwdFlowInNoThrough::fwdFlowIn(call, _, c, p, state, _, innercc, _, t, ap, stored, cc)
20012001
or
2002-
FwdFlowInThrough::fwdFlowIn(call, _, c, p, state, _, innercc, _, t, ap, _, stored, cc)
2002+
FwdFlowInThrough::fwdFlowIn(call, _, c, p, state, _, innercc, _, t, ap, stored, cc)
20032003
}
20042004

20052005
pragma[nomagic]
@@ -2070,11 +2070,11 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
20702070
pragma[nomagic]
20712071
private predicate fwdFlowRetFromArg(
20722072
RetNodeEx ret, FlowState state, CcCall ccc, SummaryCtxSome summaryCtx, Typ t, Ap ap,
2073-
ApApprox apa, TypOption stored
2073+
TypOption stored
20742074
) {
20752075
exists(ReturnKindExt kind, ParamNodeEx p, Ap argAp |
20762076
instanceofCcCall(ccc) and
2077-
fwdFlow(pragma[only_bind_into](ret), state, ccc, summaryCtx, t, ap, apa, stored) and
2077+
fwdFlow(pragma[only_bind_into](ret), state, ccc, summaryCtx, t, ap, _, stored) and
20782078
summaryCtx =
20792079
TSummaryCtxSome(pragma[only_bind_into](p), _, _, pragma[only_bind_into](argAp), _) and
20802080
not outBarrier(ret, state) and
@@ -2087,27 +2087,27 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
20872087
pragma[inline]
20882088
private predicate fwdFlowThrough0(
20892089
DataFlowCall call, ArgNodeEx arg, Cc cc, FlowState state, CcCall ccc,
2090-
SummaryCtx summaryCtx, Typ t, Ap ap, ApApprox apa, TypOption stored, RetNodeEx ret,
2090+
SummaryCtx summaryCtx, Typ t, Ap ap, TypOption stored, RetNodeEx ret,
20912091
SummaryCtxSome innerSummaryCtx
20922092
) {
2093-
fwdFlowRetFromArg(ret, state, ccc, innerSummaryCtx, t, ap, apa, stored) and
2093+
fwdFlowRetFromArg(ret, state, ccc, innerSummaryCtx, t, ap, stored) and
20942094
fwdFlowIsEntered(call, arg, cc, ccc, summaryCtx, innerSummaryCtx)
20952095
}
20962096

20972097
pragma[nomagic]
20982098
private predicate fwdFlowThrough(
20992099
DataFlowCall call, Cc cc, FlowState state, CcCall ccc, SummaryCtx summaryCtx, Typ t,
2100-
Ap ap, ApApprox apa, TypOption stored, RetNodeEx ret
2100+
Ap ap, TypOption stored, RetNodeEx ret
21012101
) {
2102-
fwdFlowThrough0(call, _, cc, state, ccc, summaryCtx, t, ap, apa, stored, ret, _)
2102+
fwdFlowThrough0(call, _, cc, state, ccc, summaryCtx, t, ap, stored, ret, _)
21032103
}
21042104

21052105
pragma[nomagic]
21062106
private predicate fwdFlowIsEntered0(
21072107
DataFlowCall call, ArgNodeEx arg, Cc cc, CcCall innerCc, SummaryCtx summaryCtx,
21082108
ParamNodeEx p, FlowState state, Typ t, Ap ap, TypOption stored
21092109
) {
2110-
FwdFlowInThrough::fwdFlowIn(call, arg, _, p, state, cc, innerCc, summaryCtx, t, ap, _,
2110+
FwdFlowInThrough::fwdFlowIn(call, arg, _, p, state, cc, innerCc, summaryCtx, t, ap,
21112111
stored, _)
21122112
}
21132113

@@ -2143,7 +2143,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
21432143
DataFlowCall call, FlowState state, CcCall ccc, Ap ap, RetNodeEx ret,
21442144
SummaryCtxSome innerSummaryCtx
21452145
) {
2146-
fwdFlowThrough0(call, _, _, state, ccc, _, _, ap, _, _, ret, innerSummaryCtx)
2146+
fwdFlowThrough0(call, _, _, state, ccc, _, _, ap, _, ret, innerSummaryCtx)
21472147
}
21482148

21492149
pragma[nomagic]
@@ -3120,11 +3120,11 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
31203120
SummaryCtx outerSummaryCtx, SummaryCtx innerSummaryCtx, Typ t, Ap ap, TypOption stored
31213121
) {
31223122
FwdFlowInNoThrough::fwdFlowIn(_, arg, _, p, state, outercc, innercc, outerSummaryCtx, t,
3123-
ap, _, stored, _) and
3123+
ap, stored, _) and
31243124
innerSummaryCtx = TSummaryCtxNone()
31253125
or
31263126
FwdFlowInThrough::fwdFlowIn(_, arg, _, p, state, outercc, innercc, outerSummaryCtx, t,
3127-
ap, _, stored, _) and
3127+
ap, stored, _) and
31283128
innerSummaryCtx = TSummaryCtxSome(p, state, t, ap, stored)
31293129
}
31303130

@@ -3134,7 +3134,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
31343134
SummaryCtx summaryCtx, Typ t, Ap ap, TypOption stored, RetNodeEx ret,
31353135
SummaryCtxSome innerSummaryCtx
31363136
) {
3137-
fwdFlowThrough0(call, arg, cc, state, ccc, summaryCtx, t, ap, _, stored, ret,
3137+
fwdFlowThrough0(call, arg, cc, state, ccc, summaryCtx, t, ap, stored, ret,
31383138
innerSummaryCtx)
31393139
}
31403140

0 commit comments

Comments
 (0)