diff options
author | Kuba Mracek <mracek@apple.com> | 2017-11-29 19:33:35 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2017-11-29 19:33:35 +0000 |
commit | 676c2f0357ff8c3150bdbb6ed77457dfd1e32058 (patch) | |
tree | 8e724e43a2cd2997f3ef96eab69bfb9be267c52f /test | |
parent | 0a7288064854a3ff716d928a0ab72fdd2bbddb72 (diff) |
[asan] Allow getpwnam(NULL) for binary compatibility
Calling getpwnam(NULL) is probably a bug, but at least on Darwin, such a call succeeds without segfaulting. I have some existing code that relies on that. To maintain binary compatibility, ASan should also survive a call to getpwnam with NULL.
Differential Revision: https://reviews.llvm.org/D40052
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/asan/TestCases/Darwin/getpwnam.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/asan/TestCases/Darwin/getpwnam.c b/test/asan/TestCases/Darwin/getpwnam.c new file mode 100644 index 000000000..db3ec3f8c --- /dev/null +++ b/test/asan/TestCases/Darwin/getpwnam.c @@ -0,0 +1,15 @@ +// RUN: %clang_asan %s -o %t +// RUN: %run %t 2>&1 | FileCheck %s + +#include <pwd.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> + +int main(int argc, const char * argv[]) { + getpwnam(NULL); + fprintf(stderr, "Finished.\n"); + return 0; +} + +// CHECK: Finished. |