Skip to content

Commit ded06a7

Browse files
committed
C++: More pruning.
1 parent bdad9e1 commit ded06a7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cpp/ql/lib/semmle/code/cpp/security/InvalidPointerDereference/AllocationToInvalidPointer.qll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ private module SizeBarrier {
101101
predicate isSource(DataFlow::Node source) {
102102
// The sources is the same as in the sources for the second
103103
// projection in the `AllocToInvalidPointerConfig` module.
104-
hasSize(_, source, _)
104+
hasSize(_, source, _) and
105+
InterestingPointerAddInstruction::isInterestingSize(source)
105106
}
106107

107108
/**
@@ -220,6 +221,13 @@ private module InterestingPointerAddInstruction {
220221
flowTo(n)
221222
)
222223
}
224+
225+
predicate isInterestingSize(DataFlow::Node n) {
226+
exists(DataFlow::Node alloc |
227+
hasSize(alloc.asConvertedExpr(), n, _) and
228+
flow(alloc, _)
229+
)
230+
}
223231
}
224232

225233
/**

0 commit comments

Comments
 (0)