1 | // RUN: %clang_cl_asan %Od %s %Fe%t |
2 | // RUN: not %run %t 2>&1 | FileCheck %s |
3 | |
4 | #include <windows.h> |
5 | #include <stdio.h> |
6 | |
7 | extern "C" const char *foo = "foobarspam" ; |
8 | |
9 | int main(void) { |
10 | if (foo[16]) |
11 | printf(format: "Boo\n" ); |
12 | // CHECK-NOT: Boo |
13 | // CHECK: AddressSanitizer: global-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] |
14 | // CHECK: READ of size 1 at [[ADDR]] thread T0 |
15 | // CHECK-NEXT: {{#0 .* main .*global_const_string_oob.cpp:}}[[@LINE-5]] |
16 | // CHECK: [[ADDR]] is located 5 bytes after global variable [[STR:.*]] defined in {{'.*global_const_string_oob.cpp' .*}} of size 11 |
17 | // CHECK: [[STR]] is ascii string 'foobarspam' |
18 | return 0; |
19 | } |
20 | |
21 | |