Bug 868797 - Update libnestegg to be more tolerant of blocks with negative timecodes. r?kinetik draft
authorBryce Van Dyk <bvandyk@mozilla.com>
Wed, 28 Feb 2018 16:34:05 -0500
changeset 761211 b670012505f59df66e2bf5947ead84d3b97a23c2
parent 760935 ee326c976eebdca48128054022c443d3993e12b0
push id100921
push userbvandyk@mozilla.com
push dateWed, 28 Feb 2018 21:35:58 +0000
reviewerskinetik
bugs868797
milestone60.0a1
Bug 868797 - Update libnestegg to be more tolerant of blocks with negative timecodes. r?kinetik Bump nestegg to commit 89ed0daf2edccb25f744e5faff88b8b4684adceb. This brings across tolerance of blocks with negative timecodes. Instead of rejecting these the timecodes are now set to 0. Also brings across a change to appease clang in ne_read_block_additions by adding an explicit assignment to data_size. MozReview-Commit-ID: 7J8YPUUwSBp
media/libnestegg/README_MOZILLA
media/libnestegg/src/nestegg.c
--- a/media/libnestegg/README_MOZILLA
+++ b/media/libnestegg/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the nestegg
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The nestegg git repository is: https://github.com/kinetiknz/nestegg
 
-The git commit ID used was 017f480db78bcdc607e6dba36cef806b793edf2c.
+The git commit ID used was 89ed0daf2edccb25f744e5faff88b8b4684adceb.
--- a/media/libnestegg/src/nestegg.c
+++ b/media/libnestegg/src/nestegg.c
@@ -1545,18 +1545,21 @@ ne_read_block(nestegg * ctx, uint64_t bl
   if (tc_scale == 0)
     return -1;
 
   if (!ctx->read_cluster_timecode)
     return -1;
   cluster_tc = ctx->cluster_timecode;
 
   abs_timecode = timecode + cluster_tc;
-  if (abs_timecode < 0)
-    return -1;
+  if (abs_timecode < 0) {
+      /* Ignore the spec and negative timestamps */
+      ctx->log(ctx, NESTEGG_LOG_WARNING, "ignoring negative timecode: %lld", abs_timecode);
+      abs_timecode = 0;
+  }
 
   pkt = ne_alloc(sizeof(*pkt));
   if (!pkt)
     return -1;
   pkt->track = track;
   pkt->timecode = abs_timecode * tc_scale * track_scale;
   pkt->keyframe = keyframe;
 
@@ -1681,16 +1684,17 @@ ne_read_block_additions(nestegg * ctx, u
   assert(*pkt_block_additional == NULL);
 
   block_additions_end = ne_io_tell(ctx->io) + block_size;
 
   while (ne_io_tell(ctx->io) < block_additions_end) {
     add_id = 1;
     data = NULL;
     has_data = 0;
+    data_size = 0;
     r = ne_read_element(ctx, &id, &size);
     if (r != 1)
       return r;
 
     if (id != ID_BLOCK_MORE) {
       /* We don't know what this element is, so skip over it */
       if (id != ID_VOID && id != ID_CRC32)
         ctx->log(ctx, NESTEGG_LOG_DEBUG,