Skip to content

Commit 66ce915

Browse files
committed
C++: respond to easy comments on ProducFlow.qll
1 parent 0ebd7d0 commit 66ce915

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

cpp/ql/lib/experimental/semmle/code/cpp/dataflow/ProductFlow.qll

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,42 @@ module ProductFlow {
2424
DataFlow::PathNode source1, DataFlow2::PathNode source2, DataFlow::PathNode sink1,
2525
DataFlow2::PathNode sink2
2626
) {
27-
isSourcePair(source1.getNode(), source2.getNode()) and
2827
isSinkPair(sink1.getNode(), sink2.getNode()) and
2928
reachablePair2(this, source1, source2, sink1, sink2)
3029
}
3130
}
3231

33-
class Conf1 extends DataFlow::Configuration {
34-
Conf1() { this = "Conf1" }
32+
private import Internal
33+
module Internal {
34+
class Conf1 extends DataFlow::Configuration {
35+
Conf1() { this = "Conf1" }
3536

36-
override predicate isSource(DataFlow::Node source) {
37-
exists(Configuration conf | conf.isSourcePair(source, _))
38-
}
37+
override predicate isSource(DataFlow::Node source) {
38+
exists(Configuration conf | conf.isSourcePair(source, _))
39+
}
3940

40-
override predicate isSink(DataFlow::Node sink) {
41-
exists(Configuration conf | conf.isSinkPair(sink, _))
41+
override predicate isSink(DataFlow::Node sink) {
42+
exists(Configuration conf | conf.isSinkPair(sink, _))
43+
}
4244
}
43-
}
4445

45-
class Conf2 extends DataFlow2::Configuration {
46-
Conf2() { this = "Conf2" }
46+
class Conf2 extends DataFlow2::Configuration {
47+
Conf2() { this = "Conf2" }
4748

48-
override predicate isSource(DataFlow::Node source) {
49-
exists(Configuration conf | conf.isSourcePair(_, source))
50-
}
49+
override predicate isSource(DataFlow::Node source) {
50+
exists(Configuration conf, DataFlow::Node source1 |
51+
conf.isSourcePair(source1, source) and
52+
any(Conf1 c).hasFlow(source1, _)
53+
)
54+
}
5155

52-
override predicate isSink(DataFlow::Node sink) {
53-
exists(Configuration conf | conf.isSinkPair(_, sink))
56+
override predicate isSink(DataFlow::Node sink) {
57+
exists(Configuration conf | conf.isSinkPair(_, sink))
58+
}
5459
}
5560
}
5661

57-
predicate reachablePair1(
62+
private predicate reachablePair1(
5863
Configuration conf, DataFlow::PathNode source1, DataFlow2::PathNode source2,
5964
DataFlow::PathNode node1, DataFlow2::PathNode node2
6065
) {
@@ -67,7 +72,7 @@ module ProductFlow {
6772
)
6873
}
6974

70-
predicate reachablePair2(
75+
private predicate reachablePair2(
7176
Configuration conf, DataFlow::PathNode source1, DataFlow2::PathNode source2,
7277
DataFlow::PathNode node1, DataFlow2::PathNode node2
7378
) {
@@ -80,7 +85,7 @@ module ProductFlow {
8085
)
8186
}
8287

83-
predicate interprocStep(
88+
private predicate interprocStep(
8489
Configuration conf, DataFlow::PathNode source1, DataFlow2::PathNode source2,
8590
DataFlow::PathNode node1, DataFlow2::PathNode node2
8691
) {
@@ -96,7 +101,7 @@ module ProductFlow {
96101
)
97102
}
98103

99-
predicate reachablePair(
104+
private predicate reachablePair(
100105
Configuration conf, DataFlow::PathNode source1, DataFlow2::PathNode source2,
101106
DataFlow::PathNode node1, DataFlow2::PathNode node2
102107
) {

0 commit comments

Comments
 (0)