[compiler-rt] [ASan][Windows] Fix false positive for zero sized rtl allocations (PR #181015)
David Justo via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 13 11:32:55 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 &&
----------------
davidmrdavid wrote:
nit - for preciseness, should we check exactly if `usable_size` is `1`? (also applicable in `asan_ms_size`)
https://github.com/llvm/llvm-project/pull/181015
More information about the llvm-commits
mailing list