18 lines · cpp
1// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s2 3namespace XXX {4class YYY {5 public:6 static char ZZZ[];7};8char YYY::ZZZ[] = "abc";9}10 11int main(int argc, char **argv) {12 return (int)XXX::YYY::ZZZ[argc + 5]; // BOOM13 // CHECK: {{READ of size 1 at 0x.*}}14 // CHECK: {{0x.* is located 2 bytes after global variable}}15 // CHECK: '{{.*}}XXX::YYY::ZZZ{{.*}}' {{.*}} of size 416 // CHECK: '{{.*}}XXX::YYY::ZZZ{{.*}}' is ascii string 'abc'17}18