CPP: Separate the dataflow case from dynamic allocation.

This commit is contained in:
Geoffrey White
2018-10-02 10:20:46 +01:00
parent ef8ca5de58
commit beb21f92d3

View File

@@ -77,10 +77,11 @@ int getBufferSize(Expr bufferExpr, Element why) {
parentClass.getSize()
)
) or (
// buffer is assigned with an allocation
DataFlow::localFlowStep(DataFlow::exprNode(why), DataFlow::exprNode(bufferExpr)) and
isFixedSizeAllocationExpr(why, result)
// buffer is a fixed size dynamic allocation
isFixedSizeAllocationExpr(bufferExpr, result) and
why = bufferExpr
) or exists(Expr def, Element why2 |
// dataflow
DataFlow::localFlowStep(DataFlow::exprNode(def), DataFlow::exprNode(bufferExpr)) and
result = getBufferSize(def, why2) and
(