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