26 lines · c
1// RUN: %clang_hwasan -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s2// RUN: %clang_hwasan -O3 -g %s -o %t && not %run %t 2>&1 | FileCheck %s3 4// Stack histories currently are not recorded on x86.5// XFAIL: target=x86_64{{.*}}6 7__attribute((noinline)) void buggy() {8 char c[64];9 char *volatile p = c;10 p[65] = 0;11}12 13int main() {14 buggy();15 // CHECK: WRITE of size 1 at16 // CHECK: #0 {{.*}} in buggy{{.*}}stack-overflow.c:[[@LINE-6]]17 // CHECK: Cause: stack tag-mismatch18 // CHECK: is located in stack of thread19 // CHECK: Potentially referenced stack objects:20 // CHECK: Cause: stack-buffer-overflow21 // CHECK-NEXT: 0x{{.*}} is located 1 bytes after a 64-byte local variable c [0x{{.*}},0x{{.*}}) in buggy {{.*}}stack-overflow.c:22 // CHECK: Memory tags around the buggy address23 24 // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in buggy25}26