Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit beb21f9

Browse files
committed
CPP: Separate the dataflow case from dynamic allocation.
1 parent ef8ca5d commit beb21f9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cpp/ql/src/semmle/code/cpp/commons/Buffer.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ int getBufferSize(Expr bufferExpr, Element why) {
7777
parentClass.getSize()
7878
)
7979
) or (
80-
// buffer is assigned with an allocation
81-
DataFlow::localFlowStep(DataFlow::exprNode(why), DataFlow::exprNode(bufferExpr)) and
82-
isFixedSizeAllocationExpr(why, result)
80+
// buffer is a fixed size dynamic allocation
81+
isFixedSizeAllocationExpr(bufferExpr, result) and
82+
why = bufferExpr
8383
) or exists(Expr def, Element why2 |
84+
// dataflow
8485
DataFlow::localFlowStep(DataFlow::exprNode(def), DataFlow::exprNode(bufferExpr)) and
8586
result = getBufferSize(def, why2) and
8687
(

0 commit comments

Comments
 (0)