[FFmpeg-cvslog] mov: Check the entries value when parsing dref boxes

Luca Barbato git at videolan.org
Wed Apr 13 18:31:03 CEST 2016


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Mar  8 11:57:16 2016 +0100| [7e01d48cfd168c3dfc663f03a3b6a98e0ecba328] | committer: Luca Barbato

mov: Check the entries value when parsing dref boxes

And properly reset the entries count when resetting the entries.

CC: libav-stable at libav.org

Bug-Id: 929
Bug-Id: CVE-2016-3062

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e01d48cfd168c3dfc663f03a3b6a98e0ecba328
---

 libavformat/mov.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index a556aa7..9d271f8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -473,9 +473,11 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     avio_rb32(pb); // version + flags
     entries = avio_rb32(pb);
-    if (entries >  (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
+    if (!entries ||
+        entries >  (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
         entries >= UINT_MAX / sizeof(*sc->drefs))
         return AVERROR_INVALIDDATA;
+    sc->drefs_count = 0;
     av_free(sc->drefs);
     sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
     if (!sc->drefs)



More information about the ffmpeg-cvslog mailing list