| 1 | // RUN: rm -rf %t-dir && mkdir -p %t-dir |
| 2 | // RUN: %clangxx_asan %s -o %t-dir/verbose-log-path_test-binary |
| 3 | |
| 4 | // The glob below requires bash. |
| 5 | // REQUIRES: shell |
| 6 | |
| 7 | // Good log_path. |
| 8 | // RUN: rm -f %t-dir/asan.log.* |
| 9 | // RUN: %env_asan_opts=log_path=%t-dir/asan.log:log_exe_name=1 not %run %t-dir/verbose-log-path_test-binary 2> %t.out |
| 10 | // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t-dir/asan.log.verbose-log-path_test-binary.* |
| 11 | |
| 12 | // FIXME: only FreeBSD, NetBSD and Linux have verbose log paths now. |
| 13 | // XFAIL: target={{.*windows-msvc.*}},android |
| 14 | // UNSUPPORTED: ios |
| 15 | |
| 16 | #include <stdlib.h> |
| 17 | #include <string.h> |
| 18 | int main(int argc, char **argv) { |
| 19 | if (argc > 2) return 0; |
| 20 | char *x = (char*)malloc(size: 10); |
| 21 | memset(s: x, c: 0, n: 10); |
| 22 | int res = x[argc * 10]; // BOOOM |
| 23 | free(ptr: x); |
| 24 | return res; |
| 25 | } |
| 26 | // CHECK-ERROR: ERROR: AddressSanitizer |
| 27 | |