Chromium Code Reviews| Index: base/process/memory_win.cc |
| diff --git a/base/process/memory_win.cc b/base/process/memory_win.cc |
| index 668214ceaf073bf604f1d2afbe233d9805c4355d..ffdd53a2650495416659eec3694dea3535c2f53b 100644 |
| --- a/base/process/memory_win.cc |
| +++ b/base/process/memory_win.cc |
| @@ -4,6 +4,7 @@ |
| #include "base/process/memory.h" |
| +#include <new.h> |
| #include <psapi.h> |
| #include "base/logging.h" |
| @@ -13,15 +14,19 @@ namespace base { |
| namespace { |
| -void OnNoMemory() { |
| - // Kill the process. This is important for security, since WebKit doesn't |
| - // NULL-check many memory allocations. If a malloc fails, returns NULL, and |
| - // the buffer is then used, it provides a handy mapping of memory starting at |
| - // address 0 for an attacker to utilize. |
| +#pragma warning(push) |
| +#pragma warning(disable: 4702) |
|
cpu_(ooo_6.6-7.5)
2015/01/10 05:39:38
funny story, this only broke the gn build because
|
| + |
| +int OnNoMemory(size_t) { |
| + // Kill the process. This is important for security since most of code |
| + // does not check the result of memory allocation. |
| __debugbreak(); |
| _exit(1); |
| + return 0; |
| } |
| +#pragma warning(pop) |
| + |
| // HeapSetInformation function pointer. |
| typedef BOOL (WINAPI* HeapSetFn)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T); |
| @@ -68,7 +73,8 @@ void EnableTerminationOnHeapCorruption() { |
| } |
| void EnableTerminationOnOutOfMemory() { |
| - std::set_new_handler(&OnNoMemory); |
| + _set_new_handler(&OnNoMemory); |
| + _set_new_mode(1); |
| } |
| HMODULE GetModuleFromAddress(void* address) { |