diff options
Diffstat (limited to 'test/hwasan/TestCases/malloc-test.c')
-rw-r--r-- | test/hwasan/TestCases/malloc-test.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/hwasan/TestCases/malloc-test.c b/test/hwasan/TestCases/malloc-test.c new file mode 100644 index 0000000000000..199464b9c3001 --- /dev/null +++ b/test/hwasan/TestCases/malloc-test.c @@ -0,0 +1,16 @@ +// Test basic malloc functionality. +// RUN: %clang_hwasan %s -o %t +// RUN: %run %t + +#include <stdlib.h> +#include <assert.h> +#include <sanitizer/hwasan_interface.h> +#include <sanitizer/allocator_interface.h> + +int main() { + __hwasan_enable_allocator_tagging(); + char *a1 = (char*)malloc(0); + assert(a1 != 0); + assert(__sanitizer_get_allocated_size(a1) == 0); + free(a1); +} |