Index: sandbox/win/tests/validation_tests/commands.cc |
diff --git a/sandbox/win/tests/validation_tests/commands.cc b/sandbox/win/tests/validation_tests/commands.cc |
index e7620c37600eb0d92e5957d5b7a794577b4b72f6..4b1209483ea9e65b5654f67a9904a538d9841679 100644 |
--- a/sandbox/win/tests/validation_tests/commands.cc |
+++ b/sandbox/win/tests/validation_tests/commands.cc |
@@ -310,5 +310,24 @@ SBOX_TESTS_COMMAND int SleepCmd(int argc, wchar_t **argv) { |
return SBOX_TEST_SUCCEEDED; |
} |
+SBOX_TESTS_COMMAND int AllocateCmd(int argc, wchar_t **argv) { |
+ if (argc != 1) |
+ return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; |
+ |
+ size_t mem_size = static_cast<size_t>(_wtoll(argv[0])); |
+ void* memory = ::VirtualAlloc(NULL, mem_size, MEM_COMMIT | MEM_RESERVE, |
+ PAGE_READWRITE); |
+ if (!memory) { |
+ // We need to give the broker a chance to kill our process on failure. |
+ ::Sleep(5000); |
+ return SBOX_TEST_DENIED; |
+ } |
+ |
+ if (!::VirtualFree(memory, 0, MEM_RELEASE)) |
+ return SBOX_TEST_FAILED; |
+ |
+ return SBOX_TEST_SUCCEEDED; |
+} |
+ |
} // namespace sandbox |