aboutsummaryrefslogtreecommitdiffstats
path: root/src/3rdparty/masm/wtf/OSAllocatorWin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/masm/wtf/OSAllocatorWin.cpp')
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorWin.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/3rdparty/masm/wtf/OSAllocatorWin.cpp b/src/3rdparty/masm/wtf/OSAllocatorWin.cpp
index f95a4841c6..bcd1f6df04 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorWin.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorWin.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "OSAllocator.h"
+#include "PageBlock.h"
#if OS(WINDOWS)
@@ -48,11 +49,20 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool e
return result;
}
-void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable, bool)
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable,
+ bool includesGuardPages)
{
void* result = VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, protection(writable, executable));
if (!result)
CRASH();
+ if (includesGuardPages) {
+ size_t guardSize = pageSize();
+ DWORD oldProtect;
+ if (!VirtualProtect(result, guardSize, protection(false, false), &oldProtect) ||
+ !VirtualProtect(static_cast<char*>(result) + bytes - guardSize, guardSize,
+ protection(false, false), &oldProtect))
+ CRASH();
+ }
return result;
}