diff options
author | Derek Bruening <bruening@google.com> | 2016-03-23 21:24:28 +0000 |
---|---|---|
committer | Derek Bruening <bruening@google.com> | 2016-03-23 21:24:28 +0000 |
commit | b584410b802362fe836cf7e0df358d25a9d50bb8 (patch) | |
tree | 87da542268c60ce89b8271ffbf137723081760d9 /compiler-rt/test | |
parent | 8fb96b958a4c36c612988d84e6e4c8e05c9da7f9 (diff) | |
download | bcm5719-llvm-b584410b802362fe836cf7e0df358d25a9d50bb8.tar.gz bcm5719-llvm-b584410b802362fe836cf7e0df358d25a9d50bb8.zip |
[sanitizer] Add strnlen to the common interceptors
Summary:
Adds strnlen to the common interceptors, under the existing flag
intercept_strlen.
Removes the now-duplicate strnlen interceptor from asan and msan.
This adds strnlen to tsan, which previously did not intercept it.
Adds a new test of strnlen to the sanitizer_common test cases.
Reviewers: samsonov
Subscribers: zhaoqin, llvm-commits, kcc
Differential Revision: http://reviews.llvm.org/D18397
llvm-svn: 264195
Diffstat (limited to 'compiler-rt/test')
-rw-r--r-- | compiler-rt/test/sanitizer_common/TestCases/strnlen.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/strnlen.c b/compiler-rt/test/sanitizer_common/TestCases/strnlen.c new file mode 100644 index 00000000000..8ab8ec91151 --- /dev/null +++ b/compiler-rt/test/sanitizer_common/TestCases/strnlen.c @@ -0,0 +1,12 @@ +// RUN: %clang %s -o %t && %run %t 2>&1 + +#include <assert.h> +#include <string.h> +int main(int argc, char **argv) { + const char *s = "mytest"; + assert(strnlen(s, 0) == 0UL); + assert(strnlen(s, 1) == 1UL); + assert(strnlen(s, 6) == strlen(s)); + assert(strnlen(s, 7) == strlen(s)); + return 0; +} |