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

Side by Side Diff: media/formats/mp4/box_definitions.cc

Issue 1189073004: Properly verify that input data is just 'pssh' boxes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/formats/mp4/box_definitions.h" 5 #include "media/formats/mp4/box_definitions.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/formats/mp4/es_descriptor.h" 8 #include "media/formats/mp4/es_descriptor.h"
9 #include "media/formats/mp4/rcheck.h" 9 #include "media/formats/mp4/rcheck.h"
10 10
11 namespace media { 11 namespace media {
12 namespace mp4 { 12 namespace mp4 {
13 13
14 FileType::FileType() {} 14 FileType::FileType() {}
15 FileType::~FileType() {} 15 FileType::~FileType() {}
16 FourCC FileType::BoxType() const { return FOURCC_FTYP; } 16 FourCC FileType::BoxType() const { return FOURCC_FTYP; }
17 17
18 bool FileType::Parse(BoxReader* reader) { 18 bool FileType::Parse(BoxReader* reader) {
19 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version)); 19 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version));
20 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC); 20 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC);
21 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands 21 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands
22 } 22 }
23 23
24 ProtectionSystemSpecificHeader::ProtectionSystemSpecificHeader() {} 24 ProtectionSystemSpecificHeader::ProtectionSystemSpecificHeader() {}
25 ProtectionSystemSpecificHeader::~ProtectionSystemSpecificHeader() {} 25 ProtectionSystemSpecificHeader::~ProtectionSystemSpecificHeader() {}
26 FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_PSSH; } 26 FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_PSSH; }
27 27
28 bool ProtectionSystemSpecificHeader::Parse(BoxReader* reader) { 28 bool ProtectionSystemSpecificHeader::Parse(BoxReader* reader) {
29 // Don't bother validating the box's contents. 29 // Don't bother validating the box's contents other than type().
ddorwin 2015/06/25 23:08:17 It's not "don't bother" - it's Fail if not the cor
jrummell 2015/06/30 00:06:03 The "don't bother" is in relation to all the other
30 RCHECK(reader->type() == BoxType());
31
30 // Copy the entire box, including the header, for passing to EME as initData. 32 // Copy the entire box, including the header, for passing to EME as initData.
31 DCHECK(raw_box.empty()); 33 DCHECK(raw_box.empty());
32 raw_box.assign(reader->data(), reader->data() + reader->size()); 34 raw_box.assign(reader->data(), reader->data() + reader->size());
33 return true; 35 return true;
34 } 36 }
35 37
36 FullProtectionSystemSpecificHeader::FullProtectionSystemSpecificHeader() {} 38 FullProtectionSystemSpecificHeader::FullProtectionSystemSpecificHeader() {}
37 FullProtectionSystemSpecificHeader::~FullProtectionSystemSpecificHeader() {} 39 FullProtectionSystemSpecificHeader::~FullProtectionSystemSpecificHeader() {}
38 FourCC FullProtectionSystemSpecificHeader::BoxType() const { 40 FourCC FullProtectionSystemSpecificHeader::BoxType() const {
39 return FOURCC_PSSH; 41 return FOURCC_PSSH;
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( 1001 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on(
1000 size_t i) const { 1002 size_t i) const {
1001 if (i >= sample_depends_on_.size()) 1003 if (i >= sample_depends_on_.size())
1002 return kSampleDependsOnUnknown; 1004 return kSampleDependsOnUnknown;
1003 1005
1004 return sample_depends_on_[i]; 1006 return sample_depends_on_[i];
1005 } 1007 }
1006 1008
1007 } // namespace mp4 1009 } // namespace mp4
1008 } // namespace media 1010 } // namespace media
OLDNEW
« media/cdm/cenc_utils_unittest.cc ('K') | « media/cdm/cenc_utils_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698