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

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: 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/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 1e756bb8170965b3f9922f955760aded94e3e1cb..5592d8f367787afe2dded0e88f965ef2a154397d 100644
--- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
@@ -287,8 +287,10 @@ void RTCDataChannel::didReceiveRawData(const char* data, size_t dataLength)
return;
}
if (m_binaryType == BinaryTypeArrayBuffer) {
- RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(data, dataLength);
- scheduleDispatchEvent(MessageEvent::create(buffer.release()));
+ RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createOrNull(data, dataLength);
+ // Being out of memory results in silent failure: message dropped.
+ if (buffer)
+ scheduleDispatchEvent(MessageEvent::create(buffer.release()));
return;
}
ASSERT_NOT_REACHED();

Powered by Google App Engine
This is Rietveld 408576698