Skip to content

Commit c160e0b

Browse files
committed
C++: Add a warning on HeuristicAllocationExpr.getSizeBytes() and similar methods.
1 parent 823c767 commit c160e0b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/ql/lib/semmle/code/cpp/models/interfaces/Allocation.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@ abstract class HeuristicAllocationExpr extends Expr {
133133

134134
/**
135135
* Gets a constant multiplier for the allocation size given by `getSizeExpr`,
136-
* in bytes.
136+
* in bytes. This predicate should be used with caution as it can be
137+
* inaccurate for allocations identified using heuristics.
137138
*/
138139
int getSizeMult() { none() }
139140

140141
/**
141142
* Gets the size of this allocation in bytes, if it is a fixed size and that
142-
* size can be determined.
143+
* size can be determined. This predicate should be used with caution as it
144+
* can be inaccurate for allocations identified using heuristics.
143145
*/
144146
int getSizeBytes() { none() }
145147

0 commit comments

Comments
 (0)