Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the C/C++ allocation modeling to include aligned_alloc across common namespaces (global C, std, and Bloomberg bsl), enabling CodeQL’s allocation reasoning to recognize these APIs as heap allocators that require deallocation.
Changes:
- Add allocation models for
::aligned_alloc,std::aligned_alloc, andbsl::aligned_allocwith the allocation-size argument mapped to parameter index 1. - Keep existing standard allocation models (
malloc,calloc,alloca, etc.) unchanged.
Show a summary per file
| File | Description |
|---|---|
cpp/ql/lib/ext/allocation/Std.allocation.model.yml |
Adds aligned_alloc entries to the allocationFunctionModel extension for global/std/bsl namespaces. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
|
I have searched for tests of |
jketema
left a comment
There was a problem hiding this comment.
Thanks for this. One comment below. Running DCA on this before approving.
There are some tests in |
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
I don't think we have been consistently adding tests there for each and every allocation function. If only because there are too many of them. |
jketema
left a comment
There was a problem hiding this comment.
DCA looks ok. There's one new TP result. I don't really understand why this shows up after this change, as aligned_alloc is not being used (it does occur in the codebase), but I don't think it's worth further investigating this.
Thanks for the contribution.
Add models of
aligned_alloc, available in several ways:::aligned_alloc, defined instdlib.h: referencestd::aligned_alloc, defined incstdlib: referencebsl::aligned_alloc, defined here.