[compiler-rt] [ASan] Honor `allocator_may_return_null` when set through user-function and fix large alloc edge case (PR #117929)

David Justo via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 11:05:22 PST 2024


================
@@ -85,8 +85,12 @@ static void NORETURN ReportInternalAllocatorOutOfMemory(uptr requested_size) {
 
 void *InternalAlloc(uptr size, InternalAllocatorCache *cache, uptr alignment) {
   void *p = RawInternalAlloc(size, cache, alignment);
-  if (UNLIKELY(!p))
+  if (UNLIKELY(!p)) {
+    if (AllocatorMayReturnNull()) {
----------------
davidmrdavid wrote:

Interesting - I could have sword this was needed, and that my test would break without it. But now that I'm re-testing this morning, the test seems to pass just fine without it. So I'll go ahead and remove it, thanks!

Removed: https://github.com/llvm/llvm-project/pull/117929/commits/7f0e5c0adb8fa4e0e238751a5df4e3640c6a72ac

https://github.com/llvm/llvm-project/pull/117929


More information about the llvm-commits mailing list