blob: bb8de16b2b8a529ee793b61a1307c347b17faca4 [file] [log] [blame]
Kostya Serebryany667a34a2013-03-22 10:36:24 +00001// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
Alexey Samsonovd66b12b2012-12-26 14:44:46 +00002
3#include <string.h>
4
5namespace XXX {
6struct YYY {
7 static int ZZZ(int x) {
8 char array[10];
9 memset(array, 0, 10);
10 return array[x]; // BOOOM
Kostya Serebryany667a34a2013-03-22 10:36:24 +000011 // 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
Alexey Samsonovd66b12b2012-12-26 14:44:46 +000015 }
16};
Alexey Samsonov49a32c12013-01-30 07:45:58 +000017} // namespace XXX
Alexey Samsonovd66b12b2012-12-26 14:44:46 +000018
19int main(int argc, char **argv) {
20 int res = XXX::YYY::ZZZ(argc + 10);
21 return res;
22}