1 // Test strict_string_checks option in strcasestr function
2 // RUN: %clang_asan %s -o %t && %run %t 2>&1
3 // RUN: %env_asan_opts=strict_string_checks=false %run %t 2>&1
4 // RUN: %env_asan_opts=strict_string_checks=true not %run %t 2>&1 | FileCheck %s
6 // There's no interceptor for strcasestr on Windows
7 // XFAIL: target={{.*windows-(msvc.*|gnu)}}
14 int main(int argc
, char **argv
) {
16 char *s1
= (char*)malloc(size
);
17 char *s2
= (char*)malloc(size
);
18 memset(s1
, 'o', size
);
19 memset(s2
, 'O', size
);
21 char* r
= strcasestr(s1
, s2
);
22 // CHECK: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
23 // CHECK: READ of size 101