[compiler-rt] 8a8c2b2 - sanitizer_common: add test that calls wcslen

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 12:37:26 PDT 2023


Author: Thurston Dang
Date: 2023-05-24T19:30:05Z
New Revision: 8a8c2b2ea54bd0ab13a0b9cde32109542836a46b

URL: https://github.com/llvm/llvm-project/commit/8a8c2b2ea54bd0ab13a0b9cde32109542836a46b
DIFF: https://github.com/llvm/llvm-project/commit/8a8c2b2ea54bd0ab13a0b9cde32109542836a46b.diff

LOG: sanitizer_common: add test that calls wcslen

This is a very simple test that calls wsclen. There are currently no other HWASan tests that call wsclen, which is why the wcslen interceptor issue (triggered by https://reviews.llvm.org/D150708 and fixed in https://reviews.llvm.org/D150909) was only detected by stage2/hwasan check on the buildbots. With this test, the issue would have been caught by stage1 check-sanitizer, with a more obvious diagnosis.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D151000

Added: 
    compiler-rt/test/sanitizer_common/TestCases/wcslen_test.c

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/wcslen_test.c b/compiler-rt/test/sanitizer_common/TestCases/wcslen_test.c
new file mode 100644
index 000000000000..28efd7659408
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/wcslen_test.c
@@ -0,0 +1,10 @@
+// RUN: %clang %s -O0 -o %t && %run %t 2>&1
+
+#include <assert.h>
+#include <wchar.h>
+
+int main(int argc, char **argv) {
+  wchar_t x[] = L"Hello World!";
+  assert(wcslen(x) == 12);
+  return 0;
+}


        


More information about the llvm-commits mailing list