]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: fix return code for trun box with no sample entries
authorGyan Doshi <ffmpeg@gyani.pro>
Sat, 20 Jul 2019 18:14:14 +0000 (23:44 +0530)
committerGyan Doshi <ffmpeg@gyani.pro>
Mon, 22 Jul 2019 17:08:09 +0000 (22:38 +0530)
A value of zero for sample_count in trun box is not
prohibited by 14496-12 section 8.8.8. 4a9d32baca
disallowed this which led the demuxer to error out
when reading the header of valid files.

libavformat/mov.c

index 327a25bbdf1f5e8dd1cdc8d76d89900a26be9450..24de5429d1d546473c27e7d7291f477ea3fa79d5 100644 (file)
@@ -4781,8 +4781,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         entries = UINT_MAX / sizeof(AVIndexEntry) - st->nb_index_entries;
         av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n");
     }
-    if (entries <= 0)
-        return -1;
+    if (entries == 0)
+        return 0;
 
     requested_size = (st->nb_index_entries + entries) * sizeof(AVIndexEntry);
     new_entries = av_fast_realloc(st->index_entries,