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