Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame^] | 1 | // Test stopset overflow in strpbrk function |
| 2 | // RUN: %clang_asan %s -o %t && ASAN_OPTIONS=strict_string_checks=true not %run %t 2>&1 | FileCheck %s |
| 3 | |
| 4 | // Test intercept_strpbrk asan option |
| 5 | // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:intercept_strpbrk=false %run %t 2>&1 |
| 6 | |
| 7 | #include <assert.h> |
| 8 | #include <string.h> |
| 9 | |
| 10 | int main(int argc, char **argv) { |
| 11 | char *r; |
| 12 | char s1[] = "c"; |
| 13 | char s2[] = {'b', 'c'}; |
| 14 | char s3 = 0; |
| 15 | r = strpbrk(s1, s2); |
| 16 | // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable |
| 17 | assert(r == s1); |
| 18 | return 0; |
| 19 | } |