summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2018-03-07 00:14:12 +0000
committerVitaly Buka <vitalybuka@google.com>2018-03-07 00:14:12 +0000
commit4f09499dc766ec4ce5170f4553a6951a5e063c29 (patch)
tree67c3bdde752c312b2550396c93d6bbb82edb048a /test/sanitizer_common
parent03e114b188efa25ce9371cd4c1e212477e0981d3 (diff)
[sanitizer] Add interceptors for wcsxfrm, wcsxfrm_l
Patch by Oliver Chang Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44133 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326852 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r--test/sanitizer_common/TestCases/Posix/wcsxfrm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Posix/wcsxfrm.c b/test/sanitizer_common/TestCases/Posix/wcsxfrm.c
new file mode 100644
index 000000000..10c6aa224
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Posix/wcsxfrm.c
@@ -0,0 +1,19 @@
+// RUN: %clang -O0 %s -o %t && %run %t
+
+#include <assert.h>
+#include <locale.h>
+#include <wchar.h>
+
+int main(int argc, char **argv) {
+ wchar_t q[10];
+ size_t n = wcsxfrm(q, L"abcdef", sizeof(q) / sizeof(wchar_t));
+ assert(n < sizeof(q));
+
+ wchar_t q2[10];
+ locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0);
+ n = wcsxfrm_l(q2, L"qwerty", sizeof(q) / sizeof(wchar_t), loc);
+ assert(n < sizeof(q2));
+
+ freelocale(loc);
+ return 0;
+}