diff --git a/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp b/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp index b52013cb361c8..66011c4afab7a 100644 --- a/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp +++ b/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp @@ -388,13 +388,13 @@ status_t SampleTable::setCompositionTimeToSampleParams( return ERROR_IO; } - if (U32_AT(header) != 0) { + uint32_t numEntries = U32_AT(&header[4]); + + if (U32_AT(header) != 0 && numEntries) { // Expected version = 0, flags = 0. return ERROR_MALFORMED; } - uint32_t numEntries = U32_AT(&header[4]); - if (data_size != ((uint64_t)numEntries + 1) * 8) { return ERROR_MALFORMED; }