HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user.
_recalloc previously did not zero new memory after reallocation.
Paths
| Differential D61268
[AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in asan_malloc_win.cc ClosedPublic Authored by mcgov on Apr 29 2019, 10:19 AM.
Details
Summary HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user. _recalloc previously did not zero new memory after reallocation.
Diff Detail Event TimelineComment Actions Let first land NFC reformatting part of this patch? Comment Actions
That's a good idea, I'll do that now. Comment Actions Watch out for compiler-rt/lib/sanitizer_common/scripts/check_lint.sh, sometimes it disagrees with what clang-format does. It runs as part of check-sanitizer on Linux but not Windows. I have run into this accidentally numerous times. If you don't want to worry about that, consider using git-clang-format to avoid reformatting lines not affected by your patch. Functionality seems good, thanks! Comment Actions fix call to get_usable_size so that it is not called unless HEAP_ZERO_MEMORY is passed in (the only case when it is needed). This revision is now accepted and ready to land.Apr 29 2019, 1:09 PM
Revision Contents
Diff 197143 compiler-rt/lib/asan/asan_malloc_win.cccompiler-rt/test/asan/TestCases/Windows/heapalloc_zero_size.cc
compiler-rt/test/asan/TestCases/Windows/recalloc_sanity.cc
|
I don't think this is needed, you can use u8 * instead which is more common across the rest of the ASan runtime.