Skip to content

Commit 389142e

Browse files
authored
[HWASan] add test for hwasan_symbolize of stack uas (#95186)
1 parent 0f53a59 commit 389142e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %clang_hwasan -Wl,--build-id -g %s -o %t
2+
// RUN: %env_hwasan_opts=symbolize=0 not %run %t 2>&1 | hwasan_symbolize --symbols $(dirname %t) --index | FileCheck %s
3+
4+
// REQUIRES: pointer-tagging
5+
6+
#include <sanitizer/hwasan_interface.h>
7+
#include <stdlib.h>
8+
9+
static volatile char sink;
10+
11+
int main(int argc, char **argv) {
12+
volatile char *y;
13+
{
14+
volatile char x[10];
15+
y = &x[0];
16+
}
17+
sink = *y;
18+
// CHECK: Potentially referenced stack object:
19+
// CHECK: 0 bytes inside a variable "x" in stack frame of function "main"
20+
// CHECK: at {{.*}}hwasan_symbolize_stack_uas.cpp:[[@LINE-6]]
21+
return 0;
22+
}

0 commit comments

Comments
 (0)