[PATCH] D47924: [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalign
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 8 10:52:17 PDT 2018
vitalybuka accepted this revision.
vitalybuka added inline comments.
This revision is now accepted and ready to land.
================
Comment at: lib/asan/asan_allocator.cc:931
+ errno = errno_EINVAL;
+ if (AllocatorMayReturnNull())
+ return nullptr;
----------------
Can you move tests in the one patch, and refactor this reports in the another?
================
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;
----------------
0 is not power of 2
so maybe fix IsPowerOfTwo, because now it rather IsTheLeastBitNotSet
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D47924
More information about the llvm-commits
mailing list