summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Posix/wcrtomb.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Posix/wcrtomb.c')
-rw-r--r--test/asan/TestCases/Posix/wcrtomb.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/asan/TestCases/Posix/wcrtomb.c b/test/asan/TestCases/Posix/wcrtomb.c
new file mode 100644
index 000000000..bd9a8bf3e
--- /dev/null
+++ b/test/asan/TestCases/Posix/wcrtomb.c
@@ -0,0 +1,16 @@
+// Function not intercepted on android.
+// UNSUPPORTED: android
+
+// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+#include <stdlib.h>
+#include <wchar.h>
+
+int main() {
+ char *buff = (char*) malloc(MB_CUR_MAX);
+ free(buff);
+ wcrtomb(buff, L'a', NULL);
+ // CHECK: use-after-free
+ // CHECK: SUMMARY
+ return 0;
+}