brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 356f1da Raw
31 lines · cpp
1// RUN: rm -rf %t; mkdir %t2// RUN: %clang_hwasan -Wl,--build-id -g %s -o %t/hwasan_overflow3// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_overflow 16 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s --check-prefixes=CHECK,AFTER04// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_overflow 17 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s --check-prefixes=CHECK,AFTER15// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_overflow -1 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s --check-prefixes=CHECK,BEFORE16// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_overflow -17 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s --check-prefixes=CHECK,BEFORE177// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_overflow 1016 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s --check-prefixes=CHECK,AFTER10008// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_overflow -1000 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s --check-prefixes=CHECK,BEFORE10009// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_overflow 1000000 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s --check-prefixes=TOOFAR10 11// REQUIRES: aarch64-target-arch12 13#include <stdlib.h>14 15static volatile char sink;16 17int main(int argc, char **argv) {18  volatile char x[16];19  sink = x[atoi(argv[1])];20  // TOOFAR-NOT: Potentially referenced stack object:21  // CHECK: Potentially referenced stack object:22  // AFTER0:   0 bytes after a variable "x" in stack frame of function "main"23  // AFTER1:   1 bytes after a variable "x" in stack frame of function "main"24  // BEFORE1:   1 bytes before a variable "x" in stack frame of function "main"25  // BEFORE17:   17 bytes before a variable "x" in stack frame of function "main"26  // BEFORE1000:   1000 bytes before a variable "x" in stack frame of function "main"27  // AFTER1000:   1000 bytes after a variable "x" in stack frame of function "main"28  // CHECK:   at {{.*}}hwasan_symbolize_stack_overflow.cpp:[[@LINE-10]]29  return 0;30}31