summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_allocator.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-08-27 14:51:36 +0000
committerAlexey Samsonov <samsonov@google.com>2012-08-27 14:51:36 +0000
commitd883c8007ea8b5ffad10d82a66b1bb262e109705 (patch)
tree4d13495edf31c92462ee60c1d553380cfc918c8b /lib/sanitizer_common/sanitizer_allocator.cc
parentb10027729a3b809469f6b6ad40407ca453d6f54a (diff)
downloadcompiler-rt-d883c8007ea8b5ffad10d82a66b1bb262e109705.tar.gz
[Sanitizer] align allocation sizes in low level allocator
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_allocator.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_allocator.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_allocator.cc b/lib/sanitizer_common/sanitizer_allocator.cc
index b08434ad6..45fcb230c 100644
--- a/lib/sanitizer_common/sanitizer_allocator.cc
+++ b/lib/sanitizer_common/sanitizer_allocator.cc
@@ -60,7 +60,8 @@ void *InternalAllocBlock(void *p) {
static LowLevelAllocateCallback low_level_alloc_callback;
void *LowLevelAllocator::Allocate(uptr size) {
- CHECK((size & (size - 1)) == 0 && "size must be a power of two");
+ // Align allocation size.
+ size = RoundUpTo(size, 8);
if (allocated_end_ - allocated_current_ < (sptr)size) {
uptr size_to_allocate = Max(size, kPageSize);
allocated_current_ =