Skip to content

Commit fabdf99

Browse files
committed
[DIFF-INFORMED] C++: ConstantSizeArrayOffByOne
1 parent 448a1ea commit fabdf99

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,20 @@ module ArrayAddressToDerefConfig implements DataFlow::StateConfigSig {
183183
pointerArithOverflow(pai, _)
184184
)
185185
}
186+
187+
predicate observeDiffInformedIncrementalMode() { any() }
188+
189+
Location getASelectedSourceLocation(DataFlow::Node source) {
190+
exists(Variable v | result = v.getLocation() | isSourceImpl(source, v))
191+
}
192+
193+
Location getASelectedSinkLocation(DataFlow::Node sink) {
194+
exists(PointerArithmeticInstruction pai, Instruction deref |
195+
result = [pai, deref].getLocation() and
196+
isInvalidPointerDerefSink2(sink, deref, _) and
197+
isSink(sink, ArrayAddressToDerefConfig::TOverflowArithmetic(pai))
198+
)
199+
}
186200
}
187201

188202
module ArrayAddressToDerefFlow = DataFlow::GlobalWithState<ArrayAddressToDerefConfig>;

0 commit comments

Comments
 (0)