Bug 1144107 - Part 2: Prevent uin32_t overflow. r=kentuckyfriedtakahe, a=2.2+
--- a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
@@ -4108,18 +4108,18 @@ Vector<MediaSource::Indice> MPEG4Source:
}
Indice indice;
indice.start_offset = offset;
indice.end_offset = offset + size;
indice.start_composition = (compositionTime * 1000000ll) / mTimescale;
// end_composition is overwritten everywhere except the last frame, where
// the presentation duration is equal to the sample duration.
- indice.end_composition = ((compositionTime + duration) * 1000000ll) /
- mTimescale;
+ indice.end_composition =
+ (compositionTime * 1000000ll + duration * 1000000ll) / mTimescale;
indice.sync = isSyncSample;
index.add(indice);
}
// Fix up composition durations so we don't end up with any unsightly gaps.
if (index.size() != 0) {
Indice* array = index.editArray();
Vector<Indice*> composition_order;