mov: Dont try to calculate with unknown durations, fix division by 0
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 14 Nov 2012 13:07:58 +0000 (14:07 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 14 Nov 2012 13:08:44 +0000 (14:08 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mov.c

index f33a5ac..01c9413 100644 (file)
@@ -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))