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

Unified Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.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/encryptedmedia/MediaKeys.cpp
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
index ff7e083e9a245770288bfb423c157cc0456b02bd..b3cfd254aab977b35ff409ea661458d69e4044f7 100644
--- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
+++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
@@ -151,7 +151,13 @@ ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, const DO
// 3. Let certificate be a copy of the contents of the serverCertificate
// parameter.
- RefPtr<DOMArrayBuffer> serverCertificateBuffer = DOMArrayBuffer::create(serverCertificate.data(), serverCertificate.byteLength());
+ //
+ // TODO(junov): crbug.com/536816
+ // Use createOrNull instead of deprecatedCreateOrCrash. It would probably
+ // be appropriate to reject the promise with a RangeError exception when
+ // array buffer allocation fails, but that behavior probably needs
+ // clarification in the spec.
+ RefPtr<DOMArrayBuffer> serverCertificateBuffer = DOMArrayBuffer::deprecatedCreateOrCrash(serverCertificate.data(), serverCertificate.byteLength());
// 4. Let promise be a new promise.
SimpleContentDecryptionModuleResultPromise* result = new SimpleContentDecryptionModuleResultPromise(scriptState);

Powered by Google App Engine
This is Rietveld 408576698