Commit 709c8710 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/movenc: Check frame rate before use.

Fixes division by 0
This is similar to how avg_frame_rate is checked elsewhere
Fixes: 6d24add0455f41b1b45b7ba615cd46f3/asan_generic_dc34c3_5480_0a2ef411cae999b9871ed71a2e481b71.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent ae514b12
......@@ -4291,7 +4291,9 @@ static int mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
AVCodecParameters *video_par = s->streams[0]->codecpar;
AVCodecParameters *audio_par = s->streams[1]->codecpar;
int audio_rate = audio_par->sample_rate;
int64_t frame_rate = (video_st->avg_frame_rate.num * 0x10000LL) / video_st->avg_frame_rate.den;
int64_t frame_rate = video_st->avg_frame_rate.den ?
(video_st->avg_frame_rate.num * 0x10000LL) / video_st->avg_frame_rate.den :
0;
int audio_kbitrate = audio_par->bit_rate / 1000;
int video_kbitrate = FFMIN(video_par->bit_rate / 1000, 800 - audio_kbitrate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment