Bug 1171067 - Properly hande box size marked as 0. r=kentuckyfriedtakahe, a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 10 Jun 2015 19:38:13 +1000
changeset 275055 1939e93908b290532cc132959f5efa8b53afd113
parent 275054 cb88dde640aa1b55d9ed030c6a8674c611745386
child 275056 b43df791dbaf4f3d8e87cccf91159342b85caf1b
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe, lizzard
bugs1171067
milestone40.0a2
Bug 1171067 - Properly hande box size marked as 0. r=kentuckyfriedtakahe, a=lizzard This indicates that the box goes to the end of the file.
media/libstagefright/binding/Box.cpp
--- a/media/libstagefright/binding/Box.cpp
+++ b/media/libstagefright/binding/Box.cpp
@@ -73,16 +73,20 @@ Box::Box(BoxContext* aContext, uint64_t 
         !byteRange->Contains(bigLengthRange) ||
         !mContext->mSource->CachedReadAt(aOffset + 8, bigLength,
                                          sizeof(bigLength), &bytes) ||
         bytes != sizeof(bigLength)) {
       return;
     }
     size = BigEndian::readUint64(bigLength);
     mBodyOffset = bigLengthRange.mEnd;
+  } else if (size == 0) {
+    // box extends to end of file.
+    size = mContext->mByteRanges.LastElement().mEnd - aOffset;
+    mBodyOffset = headerRange.mEnd;
   } else {
     mBodyOffset = headerRange.mEnd;
   }
 
   mType = BigEndian::readUint32(&header[4]);
   mChildOffset = mBodyOffset + BoxOffset(mType);
 
   MediaByteRange boxRange(aOffset, aOffset + size);