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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 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
Index: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
index bc1e32f4a090fdb4f9d5092eab00f52cbc79609f..c96bcdf24c75f5bb4b73cc04afbbf7b2f2c21992 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -136,8 +136,8 @@ PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
RefPtr<DOMArrayBufferBase> toTransfer = arrayBuffers[i];
if (!isNeuterable)
- toTransfer = DOMArrayBuffer::create(arrayBuffers[i]->buffer());
- bool result = toTransfer->transfer(contents->at(i));
+ toTransfer = DOMArrayBuffer::createOrNull(arrayBuffers[i]->buffer());
+ bool result = toTransfer ? toTransfer->transfer(contents->at(i)) : false;
if (!result) {
exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at index " + String::number(i) + " could not be transferred.");
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698