blob: 68f38728f6b62fe4e5cfdd23dcdb852ba46d77d1 [file] [log] [blame]
Alexey Samsonov13f89cd2013-06-28 15:52:44 +00001// RUN: %clangxx_asan -O0 %s -o %t && %t 2>&1 | 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}