1 // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2
3 #include <string.h>
4
5 namespace XXX {
6 struct YYY {
ZZZXXX::YYY7 static int ZZZ(int x) {
8 char array[10];
9 memset(array, 0, 10);
10 return array[x]; // BOOOM
11 // CHECK: ERROR: AddressSanitizer: stack-buffer-overflow
12 // CHECK: READ of size 1 at
13 // CHECK: is located in stack of thread T0 at offset
14 // CHECK: XXX::YYY::ZZZ
15 }
16 };
17 } // namespace XXX
18
main(int argc,char ** argv)19 int main(int argc, char **argv) {
20 int res = XXX::YYY::ZZZ(argc + 10);
21 return res;
22 }
23