1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t |
2 | |
3 | #include <assert.h> |
4 | #include <locale.h> |
5 | #include <sanitizer/msan_interface.h> |
6 | #include <stdlib.h> |
7 | #include <string.h> |
8 | |
9 | int main(void) { |
10 | char q[10]; |
11 | size_t n = strxfrm(dest: q, src: "abcdef" , n: sizeof(q)); |
12 | assert(n < sizeof(q)); |
13 | __msan_check_mem_is_initialized(x: q, size: n + 1); |
14 | |
15 | locale_t loc = newlocale(LC_ALL_MASK, locale: "C" , base: (locale_t)0); |
16 | |
17 | __msan_poison(a: &q, size: sizeof(q)); |
18 | n = strxfrm_l(dest: q, src: "qwerty" , n: sizeof(q), l: loc); |
19 | assert(n < sizeof(q)); |
20 | __msan_check_mem_is_initialized(x: q, size: n + 1); |
21 | return 0; |
22 | } |
23 | |