[FFmpeg-cvslog] mov: do not misreport empty stts

Luca Barbato git at videolan.org
Wed Oct 12 05:51:16 CEST 2011


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Oct 11 10:14:06 2011 +0200| [30c3d976f12665d5d13971172aab062a97cb1bce] | committer: Luca Barbato

mov: do not misreport empty stts

Return -1 instead of ENOMEM if entries is 0.
Fixes a av_malloc(0) crash in macosx.

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

 libavformat/mov.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4f5bb0c..0e2ad1f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1461,8 +1461,8 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     av_dlog(c->fc, "track[%i].stts.entries = %i\n",
             c->fc->nb_streams-1, entries);
 
-    if (entries >= UINT_MAX / sizeof(*sc->stts_data))
-        return -1;
+    if (!entries || entries >= UINT_MAX / sizeof(*sc->stts_data))
+        return AVERROR(EINVAL);
 
     sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
     if (!sc->stts_data)



More information about the ffmpeg-cvslog mailing list