Skip to content

Commit f15ead6

Browse files
committed
Shared: check stateful outBarrier as part of pathStep SCC
1 parent d1310c7 commit f15ead6

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,7 @@ module MakeImpl<InputSig Lang> {
26822682
) {
26832683
not isUnreachableInCall1(node2, cc) and
26842684
not inBarrier(node2, state) and
2685+
not outBarrier(node1, state) and
26852686
(
26862687
localFlowEntry(node1, pragma[only_bind_into](state)) and
26872688
(
@@ -3757,6 +3758,9 @@ module MakeImpl<InputSig Lang> {
37573758

37583759
override NodeEx getNodeEx() { result = node }
37593760

3761+
pragma[inline]
3762+
final NodeEx getNodeExOutgoing() { result = node and not outBarrier(node, state) }
3763+
37603764
override FlowState getState() { result = state }
37613765

37623766
CallContext getCallContext() { result = cc }
@@ -3928,22 +3932,22 @@ module MakeImpl<InputSig Lang> {
39283932
ap instanceof AccessPathNil
39293933
)
39303934
or
3931-
jumpStepEx(mid.getNodeEx(), node) and
3935+
jumpStepEx(mid.getNodeExOutgoing(), node) and
39323936
state = mid.getState() and
39333937
cc instanceof CallContextAny and
39343938
sc instanceof SummaryCtxNone and
39353939
t = mid.getType() and
39363940
ap = mid.getAp()
39373941
or
3938-
additionalJumpStep(mid.getNodeEx(), node) and
3942+
additionalJumpStep(mid.getNodeExOutgoing(), node) and
39393943
state = mid.getState() and
39403944
cc instanceof CallContextAny and
39413945
sc instanceof SummaryCtxNone and
39423946
mid.getAp() instanceof AccessPathNil and
39433947
t = node.getDataFlowType() and
39443948
ap = TAccessPathNil()
39453949
or
3946-
additionalJumpStateStep(mid.getNodeEx(), mid.getState(), node, state) and
3950+
additionalJumpStateStep(mid.getNodeExOutgoing(), mid.getState(), node, state) and
39473951
cc instanceof CallContextAny and
39483952
sc instanceof SummaryCtxNone and
39493953
mid.getAp() instanceof AccessPathNil and
@@ -3978,7 +3982,7 @@ module MakeImpl<InputSig Lang> {
39783982
) {
39793983
ap0 = mid.getAp() and
39803984
c = ap0.getHead() and
3981-
Stage5::readStepCand(mid.getNodeEx(), c, node) and
3985+
Stage5::readStepCand(mid.getNodeExOutgoing(), c, node) and
39823986
state = mid.getState() and
39833987
cc = mid.getCallContext()
39843988
}
@@ -3991,7 +3995,7 @@ module MakeImpl<InputSig Lang> {
39913995
exists(DataFlowType contentType |
39923996
t0 = mid.getType() and
39933997
ap0 = mid.getAp() and
3994-
Stage5::storeStepCand(mid.getNodeEx(), _, c, node, contentType, t) and
3998+
Stage5::storeStepCand(mid.getNodeExOutgoing(), _, c, node, contentType, t) and
39953999
state = mid.getState() and
39964000
cc = mid.getCallContext() and
39974001
compatibleTypes(t0, contentType)
@@ -4009,7 +4013,8 @@ module MakeImpl<InputSig Lang> {
40094013
not outBarrier(retNode, state) and
40104014
innercc = mid.getCallContext() and
40114015
innercc instanceof CallContextNoCall and
4012-
apa = mid.getAp().getApprox()
4016+
apa = mid.getAp().getApprox() and
4017+
not outBarrier(retNode, state)
40134018
)
40144019
}
40154020

@@ -4130,7 +4135,8 @@ module MakeImpl<InputSig Lang> {
41304135
pathNode(_, ret, state, cc, sc, t, ap, _) and
41314136
kind = ret.getKind() and
41324137
apa = ap.getApprox() and
4133-
parameterFlowThroughAllowed(sc.getParamNode(), kind)
4138+
parameterFlowThroughAllowed(sc.getParamNode(), kind) and
4139+
not outBarrier(ret, state)
41344140
)
41354141
}
41364142

0 commit comments

Comments
 (0)