1 // Check that without suppressions, we catch the issue.
2 // RUN: %clangxx_asan -O0 %s -o %t -framework Foundation
3 // RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s
5 // Check that suppressing a function name works within a no-fork sandbox
6 // RUN: echo "interceptor_via_fun:CFStringCreateWithBytes" > %t.supp
7 // RUN: %env_asan_opts=suppressions='"%t.supp"' \
8 // RUN: sandbox-exec -p '(version 1)(allow default)(deny process-fork)' \
9 // RUN: %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s
11 // sandbox-exec isn't available on iOS
14 #include <CoreFoundation/CoreFoundation.h>
17 char *a
= (char *)malloc(6);
20 CFStringCreateWithBytes(kCFAllocatorDefault
, (unsigned char *)a
, 10,
21 kCFStringEncodingUTF8
, FALSE
); // BOOM
22 fprintf(stderr
, "Ignored.\n");
27 // CHECK-CRASH: AddressSanitizer: heap-buffer-overflow
28 // CHECK-CRASH-NOT: Ignored.
29 // CHECK-IGNORE-NOT: AddressSanitizer: heap-buffer-overflow
30 // CHECK-IGNORE: Ignored.