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 249513 cad51d6a9b41971d76ddbda607c1081014835749
parent 249512 a0200df84a44251de75c0336a7eac12fc7e8cb9f
child 249514 b23ad0a91cd39e63f3fedba98fa960514626a7fc
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersajones, sledru
bugs1127115
milestone37.0a2
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;