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@gmx.at>
pull/111/head
Michael Niedermayer 10 years ago
parent 238247b622
commit e8f814a907
  1. 4
      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;
}

Loading…
Cancel
Save