brintos

brintos / llvm-project-archived public Read only

0
0
Text · 643 B · 9615ccf Raw
21 lines · cpp
1// RUN: %clang_cl_asan %Od %s %Fe%t2// RUN: not %run %t 2>&1 | FileCheck %s3 4#include <windows.h>5#include <stdio.h>6 7extern "C" const char *foo = "foobarspam";8 9int main(void) {10  if (foo[16])11    printf("Boo\n");12  // CHECK-NOT: Boo13  // CHECK: AddressSanitizer: global-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]14  // CHECK: READ of size 1 at [[ADDR]] thread T015  // 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 1117  // CHECK:   [[STR]] is ascii string 'foobarspam'18  return 0;19}20 21