summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 20:34:43 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 20:34:43 +0000
commit64b4e91a5bd4f535dd65f47dc15dd1ea9dbd062b (patch)
tree40288d3f82c8ed38434aa60f75cd12e9edeaa757 /media
parentc8e981c54f23d3a798d6698d0b408351b24ed290 (diff)
downloadchromium_src-64b4e91a5bd4f535dd65f47dc15dd1ea9dbd062b.zip
chromium_src-64b4e91a5bd4f535dd65f47dc15dd1ea9dbd062b.tar.gz
chromium_src-64b4e91a5bd4f535dd65f47dc15dd1ea9dbd062b.tar.bz2
MP4StreamParser: Check aux info for encrypted samples.
Without this check, if aux info (saiz/saio boxes) is missing AuxInfoNeedsToBeCached() returns false, CacheAuxInfo() will not be called and |cenc_info_| will be empty. But we'll still call runs_->GetDecryptConfig(), which assumes a non-empty |cenc_info_|. This causes the crash. Thank kqyang@chromium.org for helping find the root cause and provide the test file. BUG=361347 TEST=No crash with new test. Review URL: https://codereview.chromium.org/234423002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263338 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/formats/mp4/mp4_stream_parser.cc6
-rw-r--r--media/formats/mp4/mp4_stream_parser_unittest.cc7
2 files changed, 13 insertions, 0 deletions
diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc
index 2fac274..b8ddf30 100644
--- a/media/formats/mp4/mp4_stream_parser.cc
+++ b/media/formats/mp4/mp4_stream_parser.cc
@@ -433,6 +433,12 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
if (!audio && !video)
runs_->AdvanceRun();
+ // AuxInfo is required for encrypted samples.
+ // See ISO Common Encryption spec: ISO/IEC FDIS 23001-7:2011(E);
+ // Section 7: Common Encryption Sample Auxiliary Information.
+ if (runs_->is_encrypted() && !runs_->aux_info_size())
+ return false;
+
// Attempt to cache the auxiliary information first. Aux info is usually
// placed in a contiguous block before the sample data, rather than being
// interleaved. If we didn't cache it, this would require that we retain the
diff --git a/media/formats/mp4/mp4_stream_parser_unittest.cc b/media/formats/mp4/mp4_stream_parser_unittest.cc
index 226943e..4418d6d 100644
--- a/media/formats/mp4/mp4_stream_parser_unittest.cc
+++ b/media/formats/mp4/mp4_stream_parser_unittest.cc
@@ -206,6 +206,13 @@ TEST_F(MP4StreamParserTest, NoMoovAfterFlush) {
512));
}
+// Test an invalid file where there are encrypted samples, but
+// SampleAuxiliaryInformation{Sizes|Offsets}Box (saiz|saio) are missing.
+// The parser should fail instead of crash. See http://crbug.com/361347
+TEST_F(MP4StreamParserTest, MissingSampleAuxInfo) {
+ ParseMP4File("bear-1280x720-a_frag-cenc_missing-saiz-saio.mp4", 512);
+}
+
// TODO(strobe): Create and test media which uses CENC auxiliary info stored
// inside a private box