[FFmpeg-cvslog] avformat/utils: Fix division by 0

Michael Niedermayer git at videolan.org
Mon Feb 9 21:29:00 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Feb  9 21:14:22 2015 +0100| [e8f814a907036e43f755f35e885bfadf94c4d63b] | committer: Michael Niedermayer

avformat/utils: Fix division by 0

Fixes: signal_sigsegv_14999ef_1188_cov_2888512890_SVA_CL1_E.264

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=e8f814a907036e43f755f35e885bfadf94c4d63b
---

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index bbee059..aa96d15 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4190,8 +4190,8 @@ AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *f
 
 
     if (st->codec->ticks_per_frame > 1) {
-        if (   codec_fr.num > 0 && codec_fr.den > 0 && av_q2d(codec_fr) < av_q2d(fr)*0.7
-            && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1)
+        if (   codec_fr.num > 0 && codec_fr.den > 0 &&
+            (fr.num == 0 || av_q2d(codec_fr) < av_q2d(fr)*0.7 && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1))
             fr = codec_fr;
     }
 



More information about the ffmpeg-cvslog mailing list