Skip to content

Commit b005973

Browse files
committed
UniversalFlow: Skip property propagation to null nodes.
1 parent 1d3bad1 commit b005973

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

shared/typeflow/codeql/typeflow/UniversalFlow.qll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ module Make<LocationSig Location, UniversalFlowInput<Location> I> {
8787
)
8888
}
8989

90+
private predicate uniqStepNotNull(FlowNode n1, FlowNode n2) {
91+
uniqStep(n1, n2) and not isNull(n1)
92+
}
93+
9094
private import Internal
9195

9296
module Internal {
@@ -100,7 +104,9 @@ module Make<LocationSig Location, UniversalFlowInput<Location> I> {
100104
* Holds if data can flow from `n1` to `n2` in one step, excluding join
101105
* steps from nodes that are always null.
102106
*/
103-
predicate anyStep(FlowNode n1, FlowNode n2) { joinStepNotNull(n1, n2) or uniqStep(n1, n2) }
107+
predicate anyStep(FlowNode n1, FlowNode n2) {
108+
joinStepNotNull(n1, n2) or uniqStepNotNull(n1, n2)
109+
}
104110
}
105111

106112
private predicate sccEdge(FlowNode n1, FlowNode n2) { anyStep(n1, n2) and anyStep+(n2, n1) }
@@ -250,7 +256,7 @@ module Make<LocationSig Location, UniversalFlowInput<Location> I> {
250256
or
251257
not P::barrier(n) and
252258
(
253-
exists(FlowNode mid | hasProperty(mid) and uniqStep(mid, n))
259+
exists(FlowNode mid | hasProperty(mid) and uniqStepNotNull(mid, n))
254260
or
255261
// The following is an optimized version of
256262
// `forex(FlowNode mid | joinStepNotNull(mid, n) | hasPropery(mid))`
@@ -298,7 +304,7 @@ module Make<LocationSig Location, UniversalFlowInput<Location> I> {
298304
or
299305
not P::barrier(n) and
300306
(
301-
exists(FlowNode mid | hasProperty(mid, t) and uniqStep(mid, n))
307+
exists(FlowNode mid | hasProperty(mid, t) and uniqStepNotNull(mid, n))
302308
or
303309
// The following is an optimized version of
304310
// `forex(FlowNode mid | joinStepNotNull(mid, n) | hasPropery(mid, t))`

0 commit comments

Comments
 (0)