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

Unified Diff: third_party/WebKit/Source/web/WebSocketImpl.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
« no previous file with comments | « third_party/WebKit/Source/web/WebArrayBuffer.cpp ('k') | third_party/WebKit/Source/wtf/ArrayBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebSocketImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebSocketImpl.cpp b/third_party/WebKit/Source/web/WebSocketImpl.cpp
index 9f453f13a1310e4b483d5e26c27698bcec77ed41..f797b6de86c3b0b77889f5a3a2889319c2b2f11d 100644
--- a/third_party/WebKit/Source/web/WebSocketImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSocketImpl.cpp
@@ -172,7 +172,13 @@ void WebSocketImpl::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload)
// FIXME: Handle Blob after supporting WebBlob.
break;
case BinaryTypeArrayBuffer:
- m_client->didReceiveArrayBuffer(WebArrayBuffer(DOMArrayBuffer::create(payload->data(), payload->size())));
+ // TODO(junov): crbug.com/536816
+ // Avoid crashing when out of memory by calling createOrNull. Requires
+ // determining appropriate alternate behavior for dealing with allocation
+ // failures. Should the notification be droped? Should we just pass null
+ // data? Should we signal an error somehow?
+ RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::deprecatedCreateOrCrash(payload->data(), payload->size());
+ m_client->didReceiveArrayBuffer(WebArrayBuffer(buffer.release()));
break;
}
}
« no previous file with comments | « third_party/WebKit/Source/web/WebArrayBuffer.cpp ('k') | third_party/WebKit/Source/wtf/ArrayBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698