diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-09-09 08:58:54 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-09-09 08:58:54 +0000 |
commit | d9a5e243254764ab1024320ef34bc2a87180f4c5 (patch) | |
tree | 8d0b8b5b20eb52a77e325301230ae8789d364146 /lib/asan/lit_tests | |
parent | 85626e8127d1f795a447c1bacb5a2606c7b954d9 (diff) | |
download | compiler-rt-d9a5e243254764ab1024320ef34bc2a87180f4c5.tar.gz compiler-rt-d9a5e243254764ab1024320ef34bc2a87180f4c5.tar.bz2 compiler-rt-d9a5e243254764ab1024320ef34bc2a87180f4c5.tar.xz |
[sanitizer] Fix PR17138.
strerror_r on OSX returns a positive error code when the errno value is
unknown. Buffer contents are initialized in any case.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190295 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/lit_tests')
-rw-r--r-- | lib/asan/lit_tests/TestCases/strerror_r_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/asan/lit_tests/TestCases/strerror_r_test.cc b/lib/asan/lit_tests/TestCases/strerror_r_test.cc new file mode 100644 index 00000000..0df009b8 --- /dev/null +++ b/lib/asan/lit_tests/TestCases/strerror_r_test.cc @@ -0,0 +1,13 @@ +// RUN: %clangxx_asan -O0 %s -o %t && %t + +// Regression test for PR17138. + +#include <assert.h> +#include <string.h> + +int main() { + char buf[1024]; + char *res = (char *)strerror_r(300, buf, sizeof(buf)); + assert(res != 0); + return 0; +} |