Index: skia/ext/SkMemory_new_handler.cpp |
diff --git a/skia/ext/SkMemory_new_handler.cpp b/skia/ext/SkMemory_new_handler.cpp |
index 91adb34118f198f625e11d60d6ed7c122a0b6a6e..b45ad1cd4eec0c58e3e765480e55b8a3f6f03dc1 100644 |
--- a/skia/ext/SkMemory_new_handler.cpp |
+++ b/skia/ext/SkMemory_new_handler.cpp |
@@ -9,6 +9,10 @@ |
#include "build/build_config.h" |
#include "third_party/skia/include/core/SkTypes.h" |
+#if defined(OS_WIN) |
+#include <windows.h> |
+#endif |
+ |
// This implementation of sk_malloc_flags() and friends is similar to |
// SkMemory_malloc.cpp, except it uses base::UncheckedMalloc and friends |
// for non-SK_MALLOC_THROW calls. |
@@ -30,6 +34,13 @@ void sk_abort_no_print() { |
void sk_out_of_memory(void) { |
SkASSERT(!"sk_out_of_memory"); |
+#if defined(OS_WIN) |
+ // Kill the process. This is important for security since most of code |
+ // does not check the result of memory allocation. |
+ // https://msdn.microsoft.com/en-us/library/het71c37.aspx |
+ ::RaiseException(base::win::kOomExceptionCode, EXCEPTION_NONCONTINUABLE, 0, |
+ nullptr); |
+#endif |
abort(); |
} |