1 | // RUN: %clang_hwasan %s -o %t && not %run %t 2>&1 | FileCheck %s |
2 | |
3 | #include <stdlib.h> |
4 | |
5 | extern void *__hwasan_shadow_memory_dynamic_address; |
6 | |
7 | int main() { |
8 | char *p = (char *)malloc(size: 1); |
9 | free(ptr: __hwasan_shadow_memory_dynamic_address); |
10 | // CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{[0x]+}}[[PTR:.*]] at pc {{[0x]+}}[[PC:.*]] on thread T{{[0-9]+}} |
11 | // CHECK: #0 {{[0x]+}}{{.*}}[[PC]] in {{.*}}free |
12 | // CHECK: #1 {{.*}} in main {{.*}}wild-free-shadow.c:[[@LINE-3]] |
13 | // CHECK: {{[0x]+}}{{.*}}[[PTR]] is HWAsan shadow memory. |
14 | // CHECK-NOT: Segmentation fault |
15 | // CHECK-NOT: SIGSEGV |
16 | return 0; |
17 | } |
18 | |