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

Unified Diff: third_party/WebKit/Source/modules/mediastream/RTCDataChannel.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/modules/mediastream/RTCDataChannel.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
index a6ad926e4159ae9ef77a82f0e5edf730b2ad8190..84180b60af90d8ed1b590388eec64e3d720d361f 100644
--- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
@@ -287,7 +287,12 @@ void RTCDataChannel::didReceiveRawData(const char* data, size_t dataLength)
return;
}
if (m_binaryType == BinaryTypeArrayBuffer) {
- RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(data, dataLength);
+ // TODO(junov): crbug.com/536816
+ // Consider using createOrNull instead of deprecatedCreateOrCrash.
+ // It must be ascertained whether dropping the event or producing some
+ // kind of failure code would be an acceptable alternative to crashing
+ // the process when array buffer allocation fails.
+ RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::deprecatedCreateOrCrash(data, dataLength);
scheduleDispatchEvent(MessageEvent::create(buffer.release()));
return;
}

Powered by Google App Engine
This is Rietveld 408576698