mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 20:56:06 +00:00
[HWASAN] Modify HwasanAllocate to set the size to 1 if requested size is 0
This should keep it consistent with LSAN and ASAN, Reviewed By: vitalybuka, MaskRay Differential Revision: https://reviews.llvm.org/D143438
This commit is contained in:
parent
914f86949a
commit
c6ea5b0cd1
@ -163,7 +163,7 @@ static uptr TaggedSize(uptr size) {
|
||||
static void *HwasanAllocate(StackTrace *stack, uptr orig_size, uptr alignment,
|
||||
bool zeroise) {
|
||||
// Keep this consistent with LSAN and ASAN behavior.
|
||||
if (orig_size == 0)
|
||||
if (UNLIKELY(orig_size == 0))
|
||||
orig_size = 1;
|
||||
if (orig_size > kMaxAllowedMallocSize) {
|
||||
if (AllocatorMayReturnNull()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user