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

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: Reverting some behavior changes Created 5 years, 2 months 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 b5e74ab3befa74326948a3eca0a09c18721ff580..4083b49715182c15708fba2a1cadad545cf57914 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -159,8 +159,8 @@ PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
isNeuterable &= bufferHandles[j]->IsNeuterable();
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