OSDN Git Service

ART: Fix ArenaStack::AllocWithMemoryTool().
authorVladimir Marko <vmarko@google.com>
Mon, 15 Feb 2016 10:13:11 +0000 (10:13 +0000)
committerVladimir Marko <vmarko@google.com>
Mon, 15 Feb 2016 17:28:34 +0000 (17:28 +0000)
MEMORY_TOOL_MAKE_NOACCESS() takes the size of the address
range as the second argument, not the end the range.

Bug: 27156726
Change-Id: I05c8224a1d3c619919b203f407fb770c7c49cc9f

runtime/base/scoped_arena_allocator.cc

index 90c6ee3..7d04fa0 100644 (file)
@@ -99,7 +99,7 @@ void* ArenaStack::AllocWithMemoryTool(size_t bytes, ArenaAllocKind kind) {
   if (UNLIKELY(static_cast<size_t>(top_end_ - ptr) < rounded_bytes)) {
     ptr = AllocateFromNextArena(rounded_bytes);
     CHECK(ptr != nullptr) << "Failed to allocate memory";
-    MEMORY_TOOL_MAKE_NOACCESS(ptr, top_end_);
+    MEMORY_TOOL_MAKE_NOACCESS(ptr, top_end_ - ptr);
   }
   CurrentStats()->RecordAlloc(bytes, kind);
   top_ptr_ = ptr + rounded_bytes;