Bug 1254721: Ensure consistency between Cenc offsets and sizes table. r=gerald a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 15 Mar 2016 16:34:33 +1100
changeset 319360 4c7b6e5d1b619d47f799b4d90bd83ab8bcd215b6
parent 319359 36191ebd2e850016318e90ff29c315a4f460ae2a
child 319361 9133a529cbcd6f540c7dc980ffc11bae6781d941
push id1079
push userjlund@mozilla.com
push dateFri, 15 Apr 2016 21:02:33 +0000
treeherdermozilla-release@575fbf6786d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, lizzard
bugs1254721
milestone46.0
Bug 1254721: Ensure consistency between Cenc offsets and sizes table. r=gerald a=lizzard MozReview-Commit-ID: E1KbKIIBR87
media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp
--- a/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp
@@ -631,18 +631,18 @@ status_t
 SampleTable::parseSampleCencInfo() {
     if ((!mCencDefaultSize && !mCencInfoCount) || mCencOffsets.IsEmpty()) {
         // We don't have all the cenc information we need yet. Quietly fail and
         // hope we get the data we need later in the track header.
         ALOGV("Got half of cenc saio/saiz pair. Deferring parse until we get the other half.");
         return OK;
     }
 
-    if (!mCencSizes.IsEmpty() && mCencOffsets.Length() > 1 &&
-        mCencSizes.IsEmpty() != mCencOffsets.Length()) {
+    if ((mCencOffsets.Length() > 1 && mCencOffsets.Length() < mCencInfoCount) ||
+        (!mCencDefaultSize && mCencSizes.Length() < mCencInfoCount)) {
         return ERROR_MALFORMED;
     }
 
     if (mCencInfoCount > kMAX_ALLOCATION / sizeof(SampleCencInfo)) {
         // Avoid future OOM.
         return ERROR_MALFORMED;
     }