brintos

brintos / llvm-project-archived public Read only

0
0
Text · 864 B · 63b4da3 Raw
23 lines · cpp
1// RUN: %clang_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s2// RUN: %clang_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s3// RUN: %clang_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s4// RUN: %clang_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s5 6// When built as C on Linux, strndup is transformed to __strndup.7// RUN: %clang_asan -O3 -xc %s -o %t && not %run %t 2>&1 | FileCheck %s8 9// Unwind problem on arm: "main" is missing from the allocation stack trace.10// UNSUPPORTED: target={{.*windows-msvc.*}},target=s390{{.*}},target=arm{{.*}} && !fast-unwinder-works11 12#include <string.h>13 14char kChars[] = {'f', 'o', 'o'};15 16int main(int argc, char **argv) {17  char *copy = strndup(kChars, 3);18  copy = strndup(kChars, 10);19  // CHECK: AddressSanitizer: global-buffer-overflow20  // CHECK: {{.*}}main {{.*}}.cpp:[[@LINE-2]]21  return *copy;22}23