[FFmpeg-devel] utils.c patch to avoid divide by zero

Frank Barchard fbarchard
Wed Aug 26 03:20:47 CEST 2009


This patch avoids a divide by zero crash.  It follows the same convention as
a similar check a few lines above.
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c (revision 19697)
+++ libavformat/utils.c (working copy)
@@ -1637,7 +1637,7 @@
                     end_time = end_time1;
             }
         }
-        if (st->duration != AV_NOPTS_VALUE) {
+        if (st->duration != AV_NOPTS_VALUE && st->time_base.den) {
             duration1 = av_rescale_q(st->duration, st->time_base,
AV_TIME_BASE_Q);
             if (duration1 > duration)
                 duration = duration1;



More information about the ffmpeg-devel mailing list