summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/GuardData.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2016-02-11 15:51:31 -0800
committerChristopher Ferris <cferris@google.com>2016-02-12 17:30:30 -0800
commit72df6708c829a4c6494936fdfbda6dc7e68e647b (patch)
tree17ede0d54b6f50c3598a3fcec56f50754067690d /libc/malloc_debug/GuardData.cpp
parent72bca4b4105e24058f3f2eca024382bedb122a30 (diff)
Fix the default alignment of the allocations.
In order to enforce this constraint: The pointer returned if the allocation succeeds shall be suitably aligned so that it may be assigned to a pointer to any type of object and then used to access such an object in the space allocated. Force all allocations on 32 bit systems to have 8 byte alignment, and all allocations on 64 bit systems to have 16 byte alignment. Add a test to verify that the allocator returns the correct alignments. Bug: 26739265 Change-Id: I9af53279617408676b94e4ec6481b3ed7ffafc6a
Diffstat (limited to 'libc/malloc_debug/GuardData.cpp')
-rw-r--r--libc/malloc_debug/GuardData.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/malloc_debug/GuardData.cpp b/libc/malloc_debug/GuardData.cpp
index 4ba5253d4..c70e8f108 100644
--- a/libc/malloc_debug/GuardData.cpp
+++ b/libc/malloc_debug/GuardData.cpp
@@ -75,7 +75,7 @@ FrontGuardData::FrontGuardData(const Config& config, size_t* offset)
// Create a buffer for fast comparisons of the front guard.
cmp_mem_.resize(config.front_guard_bytes);
memset(cmp_mem_.data(), config.front_guard_value, cmp_mem_.size());
- // Assumes that front_bytes is a multiple of sizeof(uintptr_t).
+ // Assumes that front_bytes is a multiple of MINIMUM_ALIGNMENT_BYTES.
offset_ = *offset;
*offset += config.front_guard_bytes;
}