| Index: base/process/memory_win.cc
|
| diff --git a/base/process/memory_win.cc b/base/process/memory_win.cc
|
| index 58392be7844ca3fa41f0c94350d4bd3a26f77437..668214ceaf073bf604f1d2afbe233d9805c4355d 100644
|
| --- a/base/process/memory_win.cc
|
| +++ b/base/process/memory_win.cc
|
| @@ -4,7 +4,6 @@
|
|
|
| #include "base/process/memory.h"
|
|
|
| -#include <new.h>
|
| #include <psapi.h>
|
|
|
| #include "base/logging.h"
|
| @@ -14,12 +13,13 @@
|
|
|
| namespace {
|
|
|
| -int OnNoMemory(size_t) {
|
| - // Kill the process. This is important for security since most of code
|
| - // does not check the result of memory allocation.
|
| +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.
|
| __debugbreak();
|
| _exit(1);
|
| - return 0;
|
| }
|
|
|
| // HeapSetInformation function pointer.
|
| @@ -68,8 +68,7 @@
|
| }
|
|
|
| void EnableTerminationOnOutOfMemory() {
|
| - _set_new_handler(&OnNoMemory);
|
| - _set_new_mode(1);
|
| + std::set_new_handler(&OnNoMemory);
|
| }
|
|
|
| HMODULE GetModuleFromAddress(void* address) {
|
|
|