18 lines · c
1// RUN: %clang_hwasan %s -o %t && not %run %t 2>&1 | FileCheck %s2 3#include <stdlib.h>4 5extern void *__hwasan_shadow_memory_dynamic_address;6 7int main() {8 char *p = (char *)malloc(1);9 free(__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 {{.*}}free12 // CHECK: #1 {{.*}} in main {{.*}}wild-free-shadow.c:[[@LINE-3]]13 // CHECK: {{[0x]+}}{{.*}}[[PTR]] is HWAsan shadow memory.14 // CHECK-NOT: Segmentation fault15 // CHECK-NOT: SIGSEGV16 return 0;17}18