Index: src/base/platform/platform.h |
diff --git a/src/base/platform/platform.h b/src/base/platform/platform.h |
index 23ed123e66b51ee853d007da460f7b5d9e112ba4..aa30519506d691b8df57969aec2a8bddfe981831 100644 |
--- a/src/base/platform/platform.h |
+++ b/src/base/platform/platform.h |
@@ -272,6 +272,7 @@ class OS { |
DISALLOW_IMPLICIT_CONSTRUCTORS(OS); |
}; |
+ |
// Represents and controls an area of reserved memory. |
// Control of the reserved memory can be assigned to another VirtualMemory |
// object by assignment or copy-contructing. This removes the reserved memory |
@@ -329,6 +330,7 @@ class VirtualMemory { |
// inside the allocated region. |
void* address = address_; |
size_t size = size_; |
+ CHECK(InVM(address, size)); |
Reset(); |
bool result = ReleaseRegion(address, size); |
USE(result); |
@@ -360,6 +362,13 @@ class VirtualMemory { |
static bool HasLazyCommits(); |
private: |
+ bool InVM(void* address, size_t size) { |
+ return (reinterpret_cast<intptr_t>(address_) <= |
+ reinterpret_cast<intptr_t>(address)) && |
+ (reinterpret_cast<intptr_t>(address_) + size_ >= |
+ reinterpret_cast<intptr_t>(address) + size); |
+ } |
+ |
void* address_; // Start address of the virtual memory. |
size_t size_; // Size of the virtual memory. |
}; |