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

Side by Side Diff: media/cdm/ppapi/cdm_adapter.cc

Issue 558813004: Fix certificate length check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cdm/ppapi/cdm_adapter.h" 5 #include "media/cdm/ppapi/cdm_adapter.h"
6 6
7 #include "media/base/limits.h" 7 #include "media/base/limits.h"
8 #include "media/cdm/ppapi/cdm_file_io_impl.h" 8 #include "media/cdm/ppapi/cdm_file_io_impl.h"
9 #include "media/cdm/ppapi/cdm_helpers.h" 9 #include "media/cdm/ppapi/cdm_helpers.h"
10 #include "media/cdm/ppapi/cdm_logging.h" 10 #include "media/cdm/ppapi/cdm_logging.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 325 }
326 326
327 void CdmAdapter::SetServerCertificate(uint32_t promise_id, 327 void CdmAdapter::SetServerCertificate(uint32_t promise_id,
328 pp::VarArrayBuffer server_certificate) { 328 pp::VarArrayBuffer server_certificate) {
329 const uint8_t* server_certificate_ptr = 329 const uint8_t* server_certificate_ptr =
330 static_cast<const uint8_t*>(server_certificate.Map()); 330 static_cast<const uint8_t*>(server_certificate.Map());
331 const uint32_t server_certificate_size = server_certificate.ByteLength(); 331 const uint32_t server_certificate_size = server_certificate.ByteLength();
332 332
333 if (!server_certificate_ptr || 333 if (!server_certificate_ptr ||
334 server_certificate_size < media::limits::kMinCertificateLength || 334 server_certificate_size < media::limits::kMinCertificateLength ||
335 server_certificate_size > media::limits::kMinCertificateLength) { 335 server_certificate_size > media::limits::kMaxCertificateLength) {
336 RejectPromise( 336 RejectPromise(
337 promise_id, cdm::kInvalidAccessError, 0, "Incorrect certificate."); 337 promise_id, cdm::kInvalidAccessError, 0, "Incorrect certificate.");
338 return; 338 return;
339 } 339 }
340 340
341 // Initialize() doesn't report an error, so SetServerCertificate() can be 341 // Initialize() doesn't report an error, so SetServerCertificate() can be
342 // called even if Initialize() failed. 342 // called even if Initialize() failed.
343 // TODO(jrummell): Remove this code when prefixed EME gets removed. 343 // TODO(jrummell): Remove this code when prefixed EME gets removed.
344 if (!cdm_) { 344 if (!cdm_) {
345 RejectPromise(promise_id, 345 RejectPromise(promise_id,
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 } // namespace media 1358 } // namespace media
1359 1359
1360 namespace pp { 1360 namespace pp {
1361 1361
1362 // Factory function for your specialization of the Module object. 1362 // Factory function for your specialization of the Module object.
1363 Module* CreateModule() { 1363 Module* CreateModule() {
1364 return new media::CdmAdapterModule(); 1364 return new media::CdmAdapterModule();
1365 } 1365 }
1366 1366
1367 } // namespace pp 1367 } // namespace pp
OLDNEW
« 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