<Alexander G. Riccio> via llvm-dev
2016-Mar-06 19:19 UTC
[llvm-dev] MallocAllocator returns nonnull?
The MallocAllocator Allocate function is defined as: LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size, size_t /*Alignment*/) { return malloc(Size); } ...but malloc can totally return NULL? What's up? I assume this is intended to be an optimization/warning silencer? (i.e. LLVM just normally doesn't handle OOM) ...but this can cause security issues (via nullptr deref)? On a related note, maybe Allocate should be marked as LLVM_ATTRIBUTE_RETURNS_NOALIAS? Sincerely, Alexander Riccio -- "Change the world or go home." about.me/ariccio <http://about.me/ariccio> If left to my own devices, I will build more. ⁂ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160306/96fc39eb/attachment-0001.html>