Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: src/base/platform/platform-win32.cc

Issue 2396433008: [wasm] Add guard regions to end of WebAssembly.Memory buffers (Closed)
Patch Set: Merging with master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/base/platform/platform-posix.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform-win32.cc
diff --git a/src/base/platform/platform-win32.cc b/src/base/platform/platform-win32.cc
index 080e6bc0af9c6f631285adb810861e50fc2ce1ae..60b60fdcd298723fa7e8adfdec69e54300ad1402 100644
--- a/src/base/platform/platform-win32.cc
+++ b/src/base/platform/platform-win32.cc
@@ -797,6 +797,9 @@ void* OS::Allocate(const size_t requested,
return mbase;
}
+void* OS::AllocateGuarded(const size_t requested) {
+ return VirtualAlloc(nullptr, requested, MEM_RESERVE, PAGE_NOACCESS);
+}
void OS::Free(void* address, const size_t size) {
// TODO(1240712): VirtualFree has a return value which is ignored here.
@@ -821,6 +824,10 @@ void OS::Guard(void* address, const size_t size) {
VirtualProtect(address, size, PAGE_NOACCESS, &oldprotect);
}
+void OS::Unprotect(void* address, const size_t size) {
+ LPVOID result = VirtualAlloc(address, size, MEM_COMMIT, PAGE_READWRITE);
+ DCHECK_IMPLIES(result != nullptr, GetLastError() == 0);
+}
void OS::Sleep(TimeDelta interval) {
::Sleep(static_cast<DWORD>(interval.InMilliseconds()));
« no previous file with comments | « src/base/platform/platform-posix.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698