Skip to content

Commit 59d9c6e

Browse files
committed
C++: Use the pruning stage in the product-flow configuration.
1 parent f8b1dc9 commit 59d9c6e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cpp/ql/src/Security/CWE/CWE-119/OverrunWriteProductFlow.ql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ module ValidState {
120120

121121
predicate isBarrier(DataFlow::Node node, FlowState state) { none() }
122122

123+
predicate isBarrierOut(DataFlow::Node node) {
124+
node = any(DataFlow::SsaPhiNode phi).getAnInput(true)
125+
}
126+
123127
predicate isAdditionalFlowStep(
124128
DataFlow::Node node1, FlowState state1, DataFlow::Node node2, FlowState state2
125129
) {
@@ -233,7 +237,8 @@ module StringSizeConfig implements ProductFlow::StateConfigSig {
233237
// we use `state2` to remember that there was an offset (in this case an offset of `1`) added
234238
// to the size of the allocation. This state is then checked in `isSinkPair`.
235239
exists(state1) and
236-
hasSize(bufSource.asConvertedExpr(), sizeSource, state2)
240+
hasSize(bufSource.asConvertedExpr(), sizeSource, state2) and
241+
validState(sizeSource, state2)
237242
}
238243

239244
predicate isSinkPair(

0 commit comments

Comments
 (0)