Bug 1181223 - p2: Handle wrong saio/saiz size instead of assuming it is correct - r=rillian
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 05 Nov 2015 19:06:00 +0100
changeset 271582 cd0c64a4656b4d0924c2f86f4a22e58dba235d90
parent 271581 741fc69a16795f5f83a6f8af1039912b9dbacd9b
child 271583 a5555f3b971232e9991ed4d430a3336e2321475e
push id16135
push usercbook@mozilla.com
push dateMon, 09 Nov 2015 13:59:56 +0000
treeherderfx-team@5898d8162f44 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1181223
milestone45.0a1
Bug 1181223 - p2: Handle wrong saio/saiz size instead of assuming it is correct - r=rillian
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
@@ -542,17 +542,22 @@ SampleTable::setSampleAuxiliaryInformati
         if (mDataSource->readAt(
                     data_offset, mCencSizes.Elements(), mCencInfoCount)
                     < mCencInfoCount) {
             return ERROR_IO;
         }
         data_offset += mCencInfoCount;
     }
 
-    CHECK(data_offset == data_end);
+    if (data_offset != data_end) {
+        ALOGW("wrong saiz data size, expected %lu, actual %lu",
+              data_size, data_offset - (data_end - data_size));
+        // Continue, assume extra data is not important.
+        // Parser will skip past the box end.
+    }
 
     return parseSampleCencInfo();
 }
 
 status_t
 SampleTable::setSampleAuxiliaryInformationOffsetParams(
         off64_t data_offset, size_t data_size, uint32_t drm_scheme) {
     off64_t data_end = data_offset + data_size;
@@ -607,17 +612,22 @@ SampleTable::setSampleAuxiliaryInformati
             if (!mDataSource->getUInt64(data_offset, &mCencOffsets[i])) {
                 ALOGE("error reading cenc aux info offsets");
                 return ERROR_IO;
             }
             data_offset += 8;
         }
     }
 
-    CHECK(data_offset == data_end);
+    if (data_offset != data_end) {
+        ALOGW("wrong saio data size, expected %lu, actual %lu",
+              data_size, data_offset - (data_end - data_size));
+        // Continue, assume extra data is not important.
+        // Parser will skip past the box end.
+    }
 
     return parseSampleCencInfo();
 }
 
 status_t
 SampleTable::parseSampleCencInfo() {
     if ((!mCencDefaultSize && !mCencInfoCount) || mCencOffsets.IsEmpty()) {
         // We don't have all the cenc information we need yet. Quietly fail and