From c8208c52581616f4a2daf3e3649d9febb1c9bd1c Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Sat, 15 Dec 2012 18:36:23 +0000 Subject: [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 --- compiler-rt/lib/sanitizer_common/sanitizer_allocator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.h') 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); -- cgit v1.2.3