summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorJulian Lettner <jlettner@apple.com>2019-07-18 20:14:50 +0000
committerJulian Lettner <jlettner@apple.com>2019-07-18 20:14:50 +0000
commitbe7a7ae0c3da18138fa5f117765c56b5ee8df3c4 (patch)
tree599680fff24f059a9a94d1e533d4959edb071434 /compiler-rt
parent468f34d75f1eac0492e1e555dfbea679e14f093f (diff)
downloadbcm5719-llvm-be7a7ae0c3da18138fa5f117765c56b5ee8df3c4.tar.gz
bcm5719-llvm-be7a7ae0c3da18138fa5f117765c56b5ee8df3c4.zip
[ASan] Support `{f}puts(NULL)` on Darwin, part 2
Add braces around macro `{ MACRO(); }` to guard against macros that expand to multiple statements. llvm-svn: 366488
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 9f5a91ac99d..e805c8649b9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -1241,8 +1241,9 @@ INTERCEPTOR_WITH_SUFFIX(int, fputs, char *s, void *file) {
// libc file streams can call user-supplied functions, see fopencookie.
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, fputs, s, file);
- if (!SANITIZER_MAC || s)
+ if (!SANITIZER_MAC || s) { // `fputs(NULL, file)` is supported on Darwin.
COMMON_INTERCEPTOR_READ_RANGE(ctx, s, REAL(strlen)(s) + 1);
+ }
return REAL(fputs)(s, file);
}
#define INIT_FPUTS COMMON_INTERCEPT_FUNCTION(fputs)
@@ -1255,8 +1256,9 @@ INTERCEPTOR(int, puts, char *s) {
// libc file streams can call user-supplied functions, see fopencookie.
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, puts, s);
- if (!SANITIZER_MAC || s)
+ if (!SANITIZER_MAC || s) { // `puts(NULL)` is supported on Darwin.
COMMON_INTERCEPTOR_READ_RANGE(ctx, s, REAL(strlen)(s) + 1);
+ }
return REAL(puts)(s);
}
#define INIT_PUTS COMMON_INTERCEPT_FUNCTION(puts)
OpenPOWER on IntegriCloud