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

Unified Diff: media/blink/webcontentdecryptionmodulesession_impl.cc

Issue 2098143002: Improve data sanitization of initialization data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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: media/blink/webcontentdecryptionmodulesession_impl.cc
diff --git a/media/blink/webcontentdecryptionmodulesession_impl.cc b/media/blink/webcontentdecryptionmodulesession_impl.cc
index d8ae46335f44b640d10b3d39eaddda15c24222ca..1a2b21c92e1877f31df8d221bfcdee37aaa8e20c 100644
--- a/media/blink/webcontentdecryptionmodulesession_impl.cc
+++ b/media/blink/webcontentdecryptionmodulesession_impl.cc
@@ -104,6 +104,7 @@ static bool SanitizeInitData(EmeInitDataType init_data_type,
size_t init_data_length,
std::vector<uint8_t>* sanitized_init_data,
std::string* error_message) {
+ DCHECK_GT(init_data_length, 0u);
if (init_data_length > limits::kMaxInitDataLength) {
error_message->assign("Initialization data too long.");
return false;
@@ -111,6 +112,11 @@ static bool SanitizeInitData(EmeInitDataType init_data_type,
switch (init_data_type) {
case EmeInitDataType::WEBM:
+ // |init_data| for WebM is a single key.
+ if (init_data_length > limits::kMaxKeyIdLength) {
+ error_message->assign("Initialization data for WebM is too long.");
+ return false;
+ }
sanitized_init_data->assign(init_data, init_data + init_data_length);
return true;
« 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