[FFmpeg-cvslog] mov: Dont try to calculate with unknown durations, fix division by 0

Michael Niedermayer git at videolan.org
Wed Nov 14 17:40:05 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 14 14:07:58 2012 +0100| [87d073eaccc00ef2909445ae4b25128c440d9efa] | committer: Michael Niedermayer

mov: Dont try to calculate with unknown durations, fix division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/mov.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f33a5ac..01c9413 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2232,8 +2232,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                                              ((double)st->codec->width * sc->height), INT_MAX);
         }
 
-        av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
-                  sc->time_scale*st->nb_frames, st->duration, INT_MAX);
+        if (st->duration > 0)
+            av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
+                    sc->time_scale*st->nb_frames, st->duration, INT_MAX);
 
 #if FF_API_R_FRAME_RATE
         if (sc->stts_count == 1 || (sc->stts_count == 2 && sc->stts_data[1].count == 1))



More information about the ffmpeg-cvslog mailing list