diff --git a/compiler-rt/test/asan/TestCases/strcasestr-1.c b/compiler-rt/test/asan/TestCases/strcasestr-1.c index 78e14d31f278..c38871ea5362 100644 --- a/compiler-rt/test/asan/TestCases/strcasestr-1.c +++ b/compiler-rt/test/asan/TestCases/strcasestr-1.c @@ -11,14 +11,15 @@ #define _GNU_SOURCE #include #include +#include int main(int argc, char **argv) { char *r = 0; char s2[] = "c"; - char s1[] = {'a', 'C'}; - char s3 = 0; + char s1[4] = "abC"; + __asan_poison_memory_region ((char *)&s1[2], 2); r = strcasestr(s1, s2); - // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable - assert(r == s1 + 1); + // CHECK:'s1' <== Memory access at offset {{[0-9]+}} partially overflows this variable + assert(r == s1 + 2); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strcasestr-2.c b/compiler-rt/test/asan/TestCases/strcasestr-2.c index 4593a143e8fb..cca6d208cd43 100644 --- a/compiler-rt/test/asan/TestCases/strcasestr-2.c +++ b/compiler-rt/test/asan/TestCases/strcasestr-2.c @@ -11,14 +11,15 @@ #define _GNU_SOURCE #include #include +#include int main(int argc, char **argv) { char *r = 0; char s1[] = "ab"; - char s2[] = {'c'}; - char s3 = 0; + char s2[4] = "cba"; + __asan_poison_memory_region ((char *)&s2[2], 2); r = strcasestr(s1, s2); assert(r == 0); - // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s2' <== Memory access at offset {{[0-9]+}} partially overflows this variable return 0; } diff --git a/compiler-rt/test/asan/TestCases/strcspn-1.c b/compiler-rt/test/asan/TestCases/strcspn-1.c index 04675e4b420e..6cda2e210cba 100644 --- a/compiler-rt/test/asan/TestCases/strcspn-1.c +++ b/compiler-rt/test/asan/TestCases/strcspn-1.c @@ -6,14 +6,15 @@ #include #include +#include int main(int argc, char **argv) { size_t r; char s2[] = "ab"; - char s1[] = {'c', 'a'}; - char s3 = 0; + char s1[4] = "caB"; + __asan_poison_memory_region ((char *)&s1[2], 2); r = strcspn(s1, s2); - // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s1' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r == 1); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strcspn-2.c b/compiler-rt/test/asan/TestCases/strcspn-2.c index e77ce6502244..8bb4b8a57eec 100644 --- a/compiler-rt/test/asan/TestCases/strcspn-2.c +++ b/compiler-rt/test/asan/TestCases/strcspn-2.c @@ -6,14 +6,15 @@ #include #include +#include int main(int argc, char **argv) { size_t r; char s1[] = "ab"; - char s2[] = {'a'}; - char s3 = 0; + char s2[4] = "abc"; + __asan_poison_memory_region ((char *)&s2[2], 2); r = strcspn(s1, s2); - // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s2' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r == 0); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strpbrk-1.c b/compiler-rt/test/asan/TestCases/strpbrk-1.c index b7a784d99396..626e8777e1ef 100644 --- a/compiler-rt/test/asan/TestCases/strpbrk-1.c +++ b/compiler-rt/test/asan/TestCases/strpbrk-1.c @@ -6,14 +6,15 @@ #include #include +#include int main(int argc, char **argv) { char *r; char s2[] = "ab"; - char s1[] = {'c', 'a'}; - char s3 = 0; + char s1[4] = "cab"; + __asan_poison_memory_region ((char *)&s1[2], 2); r = strpbrk(s1, s2); - // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s1' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r == s1 + 1); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strpbrk-2.c b/compiler-rt/test/asan/TestCases/strpbrk-2.c index 748662be738b..29f3150e667f 100644 --- a/compiler-rt/test/asan/TestCases/strpbrk-2.c +++ b/compiler-rt/test/asan/TestCases/strpbrk-2.c @@ -6,14 +6,15 @@ #include #include +#include int main(int argc, char **argv) { char *r; char s1[] = "c"; - char s2[] = {'b', 'c'}; - char s3 = 0; + char s2[4] = "bca"; + __asan_poison_memory_region ((char *)&s2[2], 2); r = strpbrk(s1, s2); - // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s2' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r == s1); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strspn-1.c b/compiler-rt/test/asan/TestCases/strspn-1.c index c15869d90438..b0c40ea4d725 100644 --- a/compiler-rt/test/asan/TestCases/strspn-1.c +++ b/compiler-rt/test/asan/TestCases/strspn-1.c @@ -6,14 +6,15 @@ #include #include +#include int main(int argc, char **argv) { size_t r; char s2[] = "ab"; - char s1[] = {'a', 'c'}; - char s3 = 0; + char s1[4] = "acb"; + __asan_poison_memory_region ((char *)&s1[2], 2); r = strspn(s1, s2); - // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s1' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r == 1); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strspn-2.c b/compiler-rt/test/asan/TestCases/strspn-2.c index 57b3e6cd9473..4c899108de90 100644 --- a/compiler-rt/test/asan/TestCases/strspn-2.c +++ b/compiler-rt/test/asan/TestCases/strspn-2.c @@ -6,14 +6,15 @@ #include #include +#include int main(int argc, char **argv) { size_t r; char s1[] = "bbc"; - char s2[] = {'a', 'b'}; - char s3 = 0; + char s2[5] = "abcd"; + __asan_poison_memory_region ((char *)&s2[3], 2); r = strspn(s1, s2); - // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s2' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r >= 2); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strstr-1.c b/compiler-rt/test/asan/TestCases/strstr-1.c index 842e1737e0ca..d0fa25bc62ba 100644 --- a/compiler-rt/test/asan/TestCases/strstr-1.c +++ b/compiler-rt/test/asan/TestCases/strstr-1.c @@ -7,14 +7,15 @@ #include #include +#include int main(int argc, char **argv) { char *r = 0; char s2[] = "c"; - char s1[] = {'a', 'c'}; - char s3 = 0; + char s1[4] = "acb"; + __asan_poison_memory_region ((char *)&s1[2], 2); r = strstr(s1, s2); - // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s1' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r == s1 + 1); return 0; } diff --git a/compiler-rt/test/asan/TestCases/strstr-2.c b/compiler-rt/test/asan/TestCases/strstr-2.c index 77d7cc52a44b..edb700865b83 100644 --- a/compiler-rt/test/asan/TestCases/strstr-2.c +++ b/compiler-rt/test/asan/TestCases/strstr-2.c @@ -7,14 +7,15 @@ #include #include +#include int main(int argc, char **argv) { char *r = 0; char s1[] = "ab"; - char s2[] = {'c'}; - char s3 = 0; + char s2[4] = "cab"; + __asan_poison_memory_region ((char *)&s2[2], 2); r = strstr(s1, s2); - // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable + // CHECK:'s2' <== Memory access at offset {{[0-9]+}} partially overflows this variable assert(r == 0); return 0; }