Bug 1144107 - Part 2: Prevent uin32_t overflow. r=kentuckyfriedtakahe, a=2.2+
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 14 Jul 2015 09:21:27 -0400
changeset 238714 5fee19b568eb12b6a41c3c82a45dcab7bcfd9154
parent 238713 ec5080a739ec2e7026845f5aebb314ef1ebbe39d
child 238715 a952c442a4804833085adf40129792ae0b515d48
push id742
push userryanvm@gmail.com
push dateThu, 16 Jul 2015 22:30:48 +0000
treeherdermozilla-b2g37_v2_2@418b2388edb0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe, 2.2
bugs1144107
milestone37.0
Bug 1144107 - Part 2: Prevent uin32_t overflow. r=kentuckyfriedtakahe, a=2.2+
media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
--- 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;