summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2012-12-15 18:36:23 +0000
committerKostya Serebryany <kcc@google.com>2012-12-15 18:36:23 +0000
commitc8208c52581616f4a2daf3e3649d9febb1c9bd1c (patch)
tree8dcb14e91debd6be5644f84b220c40cc86799c37 /compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
parentb16ccde7a42f8e2b1870338e93c4608660fbd2a2 (diff)
downloadbcm5719-llvm-c8208c52581616f4a2daf3e3649d9febb1c9bd1c.tar.gz
bcm5719-llvm-c8208c52581616f4a2daf3e3649d9febb1c9bd1c.zip
[sanitizer] fix a bug that has crept into the sanitizer allocator and caused SEGV on allocations between 1Mb and 2Mb, improve the test
llvm-svn: 170274
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.h')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
index a9fc300f066..b10957abc36 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
@@ -297,7 +297,7 @@ class SizeClassAllocator64 {
uptr beg_idx = region->allocated_user;
uptr end_idx = beg_idx + kPopulateSize;
uptr region_beg = kSpaceBeg + kRegionSize * class_id;
- if (end_idx > region->mapped_user) {
+ if (Max(end_idx, beg_idx + size) > region->mapped_user) {
// Do the mmap for the user memory.
CHECK_GT(region->mapped_user + kUserMapSize, end_idx);
MapWithCallback(region_beg + region->mapped_user, kUserMapSize);
OpenPOWER on IntegriCloud