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

Unified Diff: content/browser/media/cdm/browser_cdm_manager.cc

Issue 1113883003: Restrict WEBM Key ID data to 128-bits for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: message Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/cdm/browser_cdm_manager.cc
diff --git a/content/browser/media/cdm/browser_cdm_manager.cc b/content/browser/media/cdm/browser_cdm_manager.cc
index 0bd8a78e68d3a8c6a1d57b9104e7afa973426cd7..14ad4e8cb92dbe1280e5ec590c1e3cafa0efaeea 100644
--- a/content/browser/media/cdm/browser_cdm_manager.cc
+++ b/content/browser/media/cdm/browser_cdm_manager.cc
@@ -36,6 +36,11 @@ using media::MediaKeys;
namespace {
+#if defined(OS_ANDROID)
+// Android only supports 128-bit key IDs.
+const size_t kAndroidKeyIdBytes = 128 / 8;
+#endif
+
// The ID used in this class is a concatenation of |render_frame_id| and
// |cdm_id|, i.e. (render_frame_id << 32) + cdm_id.
@@ -345,6 +350,15 @@ void BrowserCdmManager::OnCreateSessionAndGenerateRequest(
promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, "Init data too long.");
return;
}
+#if defined(OS_ANDROID)
+ // 'webm' initData is a single key ID. On Android the length is restricted.
+ if (init_data_type == INIT_DATA_TYPE_WEBM &&
+ init_data.size() != kAndroidKeyIdBytes) {
+ promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0,
+ "'webm' initData is not the correct length.");
+ return;
+ }
+#endif
media::EmeInitDataType eme_init_data_type;
switch (init_data_type) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698