We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bdad9e1 commit ded06a7Copy full SHA for ded06a7
1 file changed
cpp/ql/lib/semmle/code/cpp/security/InvalidPointerDereference/AllocationToInvalidPointer.qll
@@ -101,7 +101,8 @@ private module SizeBarrier {
101
predicate isSource(DataFlow::Node source) {
102
// The sources is the same as in the sources for the second
103
// projection in the `AllocToInvalidPointerConfig` module.
104
- hasSize(_, source, _)
+ hasSize(_, source, _) and
105
+ InterestingPointerAddInstruction::isInterestingSize(source)
106
}
107
108
/**
@@ -220,6 +221,13 @@ private module InterestingPointerAddInstruction {
220
221
flowTo(n)
222
)
223
224
+
225
+ predicate isInterestingSize(DataFlow::Node n) {
226
+ exists(DataFlow::Node alloc |
227
+ hasSize(alloc.asConvertedExpr(), n, _) and
228
+ flow(alloc, _)
229
+ )
230
+ }
231
232
233
0 commit comments