[PATCH] D47924: [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalign
Aleksey Shlyapnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 8 11:37:21 PDT 2018
alekseyshl added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_allocator_checks.h:47
#if SANITIZER_POSIX
- return IsPowerOfTwo(alignment) && (size & (alignment - 1)) == 0;
+ return alignment != 0 && IsPowerOfTwo(alignment) &&
+ (size & (alignment - 1)) == 0;
----------------
vitalybuka wrote:
> 0 is not power of 2
> so maybe fix IsPowerOfTwo, because now it rather IsTheLeastBitNotSet
I thought about that, but it is used in many places where we already know that the argument is not 0. I do not want to impose the overhead on all its users.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D47924
More information about the llvm-commits
mailing list