[FFmpeg-devel,1/2] lavf/movdec: fix demuxing files with 0-entry trun atoms

Submitted by Rodger Combs on March 16, 2019, 10:22 a.m.

Details

Message ID 20190316102203.69741-1-rodger.combs@gmail.com
State New
Headers show

Commit Message

Rodger Combs March 16, 2019, 10:22 a.m.
Regressed in 4a9d32baca3af0d1831f9556a922c7ab5b426b10
---
 libavformat/mov.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavformat/mov.c b/libavformat/mov.c
index a7d444b0ee..0dfee2e7c4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4739,6 +4739,8 @@  static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     flags = avio_rb24(pb);
     entries = avio_rb32(pb);
     av_log(c->fc, AV_LOG_TRACE, "flags 0x%x entries %u\n", flags, entries);
+    if (entries == 0)
+        return 0;
 
     if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
         return AVERROR_INVALIDDATA;