[compiler-rt] [ASan][Windows] Fix false positive for zero sized rtl allocations (PR #181015)
Zack Johnson via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 13 12:21:02 PST 2026
================
@@ -1125,6 +1150,14 @@ uptr asan_malloc_usable_size(const void *ptr, uptr pc, uptr bp) {
GET_STACK_TRACE_FATAL(pc, bp);
ReportMallocUsableSizeNotOwned((uptr)ptr, &stack);
}
+#if SANITIZER_WINDOWS
+ // Zero-size allocations are internally upgraded to size 1, but we should
+ // report the originally requested size (0) to the user via
+ // HeapSize/RtlSizeHeap.
+ if (usable_size > 0 &&
----------------
zacklj89 wrote:
When `from_zero_alloc` is set, `UsedSize()` is always exactly 1 by construction so that check isn't needed. We can add a `DCHECK(usable_size == 1);` if anything?
https://github.com/llvm/llvm-project/pull/181015
More information about the llvm-commits
mailing list