mov: compute avg_frame_rate only if duration is known
authorJanne Grunau <janne-libav@jannau.net>
Fri, 23 Nov 2012 15:33:36 +0000 (16:33 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Fri, 7 Dec 2012 10:43:28 +0000 (11:43 +0100)
Fixes an assert in fuzzed sample sample.mp4_s265930.

libavformat/mov.c

index c6ff84b..a0ede86 100644 (file)
@@ -2052,8 +2052,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 != AV_NOPTS_VALUE)
+            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))