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 4 5 // Check that suppressing the interceptor by name works. 6 // RUN: echo "interceptor_name:memmove" > %t.supp 7 // RUN: %env_asan_opts=suppressions='"%t.supp"' %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s 8 9 // Check that suppressing by interceptor name works even without the symbolizer 10 // RUN: %env_asan_opts=suppressions='"%t.supp"':symbolize=false %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s 11 12 // Check that suppressing all reports from a library works. 13 // RUN: echo "interceptor_via_lib:CoreFoundation" > %t.supp 14 // RUN: %env_asan_opts=suppressions='"%t.supp"' %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s 15 16 // Check that suppressing library works even without the symbolizer. 17 // RUN: %env_asan_opts=suppressions='"%t.supp"':symbolize=false %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s 18 19 #include <CoreFoundation/CoreFoundation.h> 20 21 int main() { 22 char *a = (char *)malloc(6); 23 strcpy(a, "hello"); 24 CFStringRef str = 25 CFStringCreateWithBytes(kCFAllocatorDefault, (unsigned char *)a, 10, 26 kCFStringEncodingUTF8, FALSE); // BOOM 27 fprintf(stderr, "Ignored.\n"); 28 free(a); 29 } 30 31 // CHECK-CRASH: AddressSanitizer: heap-buffer-overflow 32 // CHECK-CRASH-NOT: Ignored. 33 // CHECK-IGNORE-NOT: AddressSanitizer: heap-buffer-overflow 34 // CHECK-IGNORE: Ignored. 35