Bug 1127115 - Make MP4 parser assertion non-fatal. r=ajones, a=sledru
authorEdwin Flores <eflores@mozilla.com>
Fri, 30 Jan 2015 16:54:12 +1300
changeset 243625 c76f32421541
parent 243624 f402bfa9a35e
child 243626 f3b474a7e351
push id4420
push userryanvm@gmail.com
push date2015-02-02 16:43 +0000
treeherdermozilla-beta@e98376bbdf79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersajones, sledru
bugs1127115
milestone36.0
Bug 1127115 - Make MP4 parser assertion non-fatal. r=ajones, a=sledru
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
@@ -252,17 +252,20 @@ status_t SampleTable::setSampleToChunkPa
     for (uint32_t i = 0; i < mNumSampleToChunkOffsets; ++i) {
         uint8_t buffer[12];
         if (mDataSource->readAt(
                     mSampleToChunkOffset + 8 + i * 12, buffer, sizeof(buffer))
                 != (ssize_t)sizeof(buffer)) {
             return ERROR_IO;
         }
 
-        CHECK(U32_AT(buffer) >= 1);  // chunk index is 1 based in the spec.
+        if (!U32_AT(buffer)) {
+          ALOGE("error reading sample to chunk table");
+          return ERROR_MALFORMED;  // chunk index is 1 based in the spec.
+        }
 
         // We want the chunk index to be 0-based.
         mSampleToChunkEntries[i].startChunk = U32_AT(buffer) - 1;
         mSampleToChunkEntries[i].samplesPerChunk = U32_AT(&buffer[4]);
         mSampleToChunkEntries[i].chunkDesc = U32_AT(&buffer[8]);
     }
 
     return OK;