Index: media/formats/mp4/box_definitions.cc |
diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc |
index 1912aaeb640fef0a46d07579f70a51eaad78559b..5b67633252c58565a15da78626f328e7237351cd 100644 |
--- a/media/formats/mp4/box_definitions.cc |
+++ b/media/formats/mp4/box_definitions.cc |
@@ -349,6 +349,15 @@ AVCDecoderConfigurationRecord::~AVCDecoderConfigurationRecord() {} |
FourCC AVCDecoderConfigurationRecord::BoxType() const { return FOURCC_AVCC; } |
bool AVCDecoderConfigurationRecord::Parse(BoxReader* reader) { |
+ return ParseInternal(reader); |
+} |
+ |
+bool AVCDecoderConfigurationRecord::Parse(const uint8* data, int data_size) { |
+ BufferReader reader(data, data_size); |
+ return ParseInternal(&reader); |
+} |
+ |
+bool AVCDecoderConfigurationRecord::ParseInternal(BufferReader* reader) { |
RCHECK(reader->Read1(&version) && version == 1 && |
reader->Read1(&profile_indication) && |
reader->Read1(&profile_compatibility) && |
@@ -359,6 +368,8 @@ bool AVCDecoderConfigurationRecord::Parse(BoxReader* reader) { |
(length_size_minus_one & 0xfc) == 0xfc); |
length_size = (length_size_minus_one & 0x3) + 1; |
+ RCHECK(length_size != 3); // Only values of 1, 2, and 4 are valid. |
+ |
uint8 num_sps; |
RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0); |
num_sps &= 0x1f; |