diff options
author | Dokyung Song <dokyungs@google.com> | 2020-07-14 00:56:02 +0300 |
---|---|---|
committer | Matt Morehouse <mascasa@google.com> | 2020-07-14 01:35:01 +0300 |
commit | 10aa0d7bbc12bf86958bc40943e37b46c6eed04a (patch) | |
tree | c2b60981ce7ecec23053aacde8853a337f79f104 /compiler-rt | |
parent | bfa3b627c6832552a7808a9f0f7f9cab61c7ea1a (diff) |
[compiler-rt] Fix compiler warnings and runtime errors in sanitizer RT strxfrm(_l) test cases.
Summary: Fixed an implicit definition warning by including <string.h>. Also fixed run-time assertions that the return value of strxfrm_l calls is less than the buffer size by increasing the size of the referenced buffer.
Reviewers: morehouse
Reviewed By: morehouse
Subscribers: dberris, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D83593
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/test/msan/__strxfrm_l.cpp | 2 | ||||
-rw-r--r-- | compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler-rt/test/msan/__strxfrm_l.cpp b/compiler-rt/test/msan/__strxfrm_l.cpp index c4eb10efb3e0..9766d3305685 100644 --- a/compiler-rt/test/msan/__strxfrm_l.cpp +++ b/compiler-rt/test/msan/__strxfrm_l.cpp @@ -10,7 +10,7 @@ extern "C" decltype(strxfrm_l) __strxfrm_l; int main(void) { - char q[10]; + char q[100]; locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0); size_t n = __strxfrm_l(q, "qwerty", sizeof(q), loc); assert(n < sizeof(q)); diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c index c28eb65b7d4f..d08af1b3565f 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c @@ -3,16 +3,16 @@ #include <assert.h> #include <locale.h> -#include <wchar.h> +#include <string.h> int main(int argc, char **argv) { char q[10]; size_t n = strxfrm(q, "abcdef", sizeof(q)); assert(n < sizeof(q)); - char q2[10]; + char q2[100]; locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0); - n = strxfrm_l(q2, L"qwerty", sizeof(q), loc); + n = strxfrm_l(q2, "qwerty", sizeof(q2), loc); assert(n < sizeof(q2)); freelocale(loc); |