[PATCH] D64773: [ASan] Support `{f}puts(NULL)` on Darwin
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 13:16:42 PDT 2019
yln marked 2 inline comments as done.
yln added inline comments.
================
Comment at: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc:1244
COMMON_INTERCEPTOR_ENTER(ctx, fputs, s, file);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, s, REAL(strlen)(s) + 1);
+ if (!SANITIZER_MAC || s)
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, s, REAL(strlen)(s) + 1);
----------------
delcypher wrote:
> @yln
>
> There are a few things I would have done differently here
>
> * Add a comment explaining why we do this on mac. Just referencing the man page is probably fine.
> * put `COMMON_INTERCEPTOR_READ_RANGE(...)` in curly braces. Because `COMMON_INTERCEPTOR_READ_RANGE` is a macro this feels like a disaster waiting to happen because the macro could expand into to multiple statements with the end result being that only the first statement gets guarded. I looked at how `COMMON_INTERCEPTOR_READ_RANGE` is implement and it's fine in this case because it uses (after several macro expansions) `do {...} while (false)` idiom.
Good points, thanks!
Updated in `be7a7ae0c3da18138fa5f117765c56b5ee8df3c4`.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64773/new/
https://reviews.llvm.org/D64773
More information about the llvm-commits
mailing list