Skip to content

Commit 9123657

Browse files
committed
C++: Update product flow to match data flow naming
1 parent a38c317 commit 9123657

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module ProductFlow {
6767
default predicate isBarrierIn2(DataFlow::Node node) { none() }
6868
}
6969

70-
module Make<ConfigSig Config> {
70+
module Global<ConfigSig Config> {
7171
private module StateConfig implements StateConfigSig {
7272
class FlowState1 = Unit;
7373

@@ -132,7 +132,7 @@ module ProductFlow {
132132
predicate isBarrierIn2 = Config::isBarrierIn2/1;
133133
}
134134

135-
import MakeWithState<StateConfig>
135+
import GlobalWithState<StateConfig>
136136
}
137137

138138
signature module StateConfigSig {
@@ -244,7 +244,7 @@ module ProductFlow {
244244
default predicate isBarrierIn2(DataFlow::Node node) { none() }
245245
}
246246

247-
module MakeWithState<StateConfigSig Config> {
247+
module GlobalWithState<StateConfigSig Config> {
248248
class PathNode1 = Flow1::PathNode;
249249

250250
class PathNode2 = Flow2::PathNode;
@@ -257,7 +257,7 @@ module ProductFlow {
257257

258258
class FlowState2 = Config::FlowState2;
259259

260-
predicate hasFlowPath(
260+
predicate flowPath(
261261
Flow1::PathNode source1, Flow2::PathNode source2, Flow1::PathNode sink1, Flow2::PathNode sink2
262262
) {
263263
reachable(source1, source2, sink1, sink2)
@@ -287,7 +287,7 @@ module ProductFlow {
287287
predicate isBarrierIn(DataFlow::Node node) { Config::isBarrierIn1(node) }
288288
}
289289

290-
module Flow1 = DataFlow::MakeWithState<Config1>;
290+
module Flow1 = DataFlow::GlobalWithState<Config1>;
291291

292292
module Config2 implements DataFlow::StateConfigSig {
293293
class FlowState = FlowState2;
@@ -319,7 +319,7 @@ module ProductFlow {
319319
predicate isBarrierIn(DataFlow::Node node) { Config::isBarrierIn2(node) }
320320
}
321321

322-
module Flow2 = DataFlow::MakeWithState<Config2>;
322+
module Flow2 = DataFlow::GlobalWithState<Config2>;
323323

324324
pragma[nomagic]
325325
private predicate reachableInterprocEntry(

cpp/ql/src/experimental/Likely Bugs/ArrayAccessProductFlow.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module ArraySizeConfig implements ProductFlow::ConfigSig {
6161
}
6262
}
6363

64-
module ArraySizeFlow = ProductFlow::Make<ArraySizeConfig>;
64+
module ArraySizeFlow = ProductFlow::Global<ArraySizeConfig>;
6565

6666
pragma[nomagic]
6767
predicate isSinkPair1(
@@ -78,7 +78,7 @@ predicate isSinkPair1(
7878
from
7979
ArraySizeFlow::PathNode1 source1, ArraySizeFlow::PathNode2 source2,
8080
ArraySizeFlow::PathNode1 sink1, ArraySizeFlow::PathNode2 sink2
81-
where ArraySizeFlow::hasFlowPath(source1, source2, sink1, sink2)
81+
where ArraySizeFlow::flowPath(source1, source2, sink1, sink2)
8282
// TODO: pull delta out and display it
8383
select sink1.getNode(), source1, sink1, "Off-by one error allocated at $@ bounded by $@.", source1,
8484
source1.toString(), sink2, sink2.toString()

cpp/ql/src/experimental/Likely Bugs/OverrunWriteProductFlow.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ module StringSizeConfig implements ProductFlow::StateConfigSig {
132132
}
133133
}
134134

135-
module StringSizeFlow = ProductFlow::MakeWithState<StringSizeConfig>;
135+
module StringSizeFlow = ProductFlow::GlobalWithState<StringSizeConfig>;
136136

137137
from
138138
StringSizeFlow::PathNode1 source1, StringSizeFlow::PathNode2 source2,
139139
StringSizeFlow::PathNode1 sink1, StringSizeFlow::PathNode2 sink2, int overflow, int sinkState,
140140
CallInstruction c, DataFlow::Node sourceNode, Expr buffer, string element
141141
where
142-
StringSizeFlow::hasFlowPath(source1, source2, sink1, sink2) and
142+
StringSizeFlow::flowPath(source1, source2, sink1, sink2) and
143143
sinkState = sink2.getState() and
144144
isSinkPairImpl(c, sink1.getNode(), sink2.getNode(), overflow + sinkState, buffer) and
145145
overflow > 0 and

cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ module AllocToInvalidPointerConfig implements ProductFlow::StateConfigSig {
161161
}
162162
}
163163

164-
module AllocToInvalidPointerFlow = ProductFlow::MakeWithState<AllocToInvalidPointerConfig>;
164+
module AllocToInvalidPointerFlow = ProductFlow::GlobalWithState<AllocToInvalidPointerConfig>;
165165

166166
/**
167167
* Holds if `pai` is non-strictly upper bounded by `sink2 + delta` and `sink1` is the
@@ -246,7 +246,7 @@ predicate invalidPointerToDerefSource(
246246
) {
247247
exists(AllocToInvalidPointerFlow::PathNode1 p, DataFlow::Node sink1 |
248248
pragma[only_bind_out](p.getNode()) = sink1 and
249-
AllocToInvalidPointerFlow::hasFlowPath(_, _, pragma[only_bind_into](p), _) and
249+
AllocToInvalidPointerFlow::flowPath(_, _, pragma[only_bind_into](p), _) and
250250
isSinkImpl(pai, sink1, _, _) and
251251
bounded2(source.asInstruction(), pai, delta) and
252252
delta >= 0
@@ -368,7 +368,7 @@ predicate hasFlowPath(
368368
PointerArithmeticInstruction pai, string operation
369369
) {
370370
exists(InvalidPointerToDerefFlow::PathNode sink3, AllocToInvalidPointerFlow::PathNode1 sink1 |
371-
AllocToInvalidPointerFlow::hasFlowPath(source1.asPathNode1(), _, sink1, _) and
371+
AllocToInvalidPointerFlow::flowPath(source1.asPathNode1(), _, sink1, _) and
372372
joinOn1(pai, sink1, source3) and
373373
InvalidPointerToDerefFlow::flowPath(source3, sink3) and
374374
joinOn2(sink3, sink.asSinkNode(), operation)

0 commit comments

Comments
 (0)