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

Unified Diff: Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp

Issue 242323003: Crash the renderer when WebSocket fails to allocate an ArrayBuffer to set to a MessageEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 7 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
« no previous file with comments | « Source/modules/websockets/WebSocket.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp
diff --git a/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp b/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp
index f66c0f15f6d66acb8b278374a6aceecec3760a6e..90146edf4358ac7ea36b218eaebf14bc4c360929 100644
--- a/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp
+++ b/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp
@@ -50,6 +50,7 @@
#include "public/platform/Platform.h"
#include "public/platform/WebWaitableEvent.h"
#include "wtf/ArrayBuffer.h"
+#include "wtf/Assertions.h"
#include "wtf/Functional.h"
#include "wtf/MainThread.h"
@@ -305,6 +306,12 @@ void WorkerThreadableWebSocketChannel::Peer::sendArrayBuffer(PassOwnPtr<Vector<c
m_syncHelper->setSendRequestResult(WebSocketChannel::SendFail);
} else {
RefPtr<ArrayBuffer> binaryData = ArrayBuffer::create(data->data(), data->size());
+ if (!binaryData) {
+ // Failed to allocate an ArrayBuffer. We need to crash the renderer
+ // since there's no way defined in the spec to tell this to the
+ // user.
+ CRASH();
+ }
WebSocketChannel::SendResult sendRequestResult = m_mainWebSocketChannel->send(*binaryData, 0, binaryData->byteLength());
m_syncHelper->setSendRequestResult(sendRequestResult);
}
« no previous file with comments | « Source/modules/websockets/WebSocket.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698