Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions compiler-rt/lib/msan/msan_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,6 @@ static void *MsanAllocate(BufferedStackTrace *stack, uptr size, uptr alignment,
__msan_set_origin(allocated, size, o.raw_id());
}
}

uptr actually_allocated_size = allocator.GetActuallyAllocatedSize(allocated);
// For compatibility, the allocator converted 0-sized allocations into 1 byte
if (size == 0 && actually_allocated_size > 0 && flags()->poison_in_malloc)
__msan_poison(allocated, 1);

UnpoisonParam(2);
RunMallocHooks(allocated, size);
return allocated;
Expand Down
4 changes: 4 additions & 0 deletions compiler-rt/test/msan/zero_alloc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// RUN: %clang_msan -Wno-alloc-size -fsanitize-recover=memory %s -o %t && not %run %t 2>&1 | FileCheck %s

// MSan doesn't catch this because internally it translates 0-byte allocations
// into 1-byte
// XFAIL: *

#include <malloc.h>
#include <stdio.h>

Expand Down