mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
CPP: Include sizeof(expr) expressions in isDynamicallyAllocatedWithDifferentSize.
This commit is contained in:
@@ -16,11 +16,12 @@ import semmle.code.cpp.dataflow.DataFlow
|
||||
* ```
|
||||
*/
|
||||
private predicate isDynamicallyAllocatedWithDifferentSize(Class s) {
|
||||
exists(SizeofTypeOperator sof |
|
||||
sof.getTypeOperand().getUnspecifiedType() = s |
|
||||
exists(SizeofOperator so |
|
||||
so.(SizeofTypeOperator).getTypeOperand().getUnspecifiedType() = s or
|
||||
so.(SizeofExprOperator).getExprOperand().getType().getUnspecifiedType() = s |
|
||||
// Check all ancestor nodes except the immediate parent for
|
||||
// allocations.
|
||||
isStdLibAllocationExpr(sof.getParent().(Expr).getParent+())
|
||||
isStdLibAllocationExpr(so.getParent().(Expr).getParent+())
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user