diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-11-17 19:02:14 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-11-17 19:03:41 +0100 |
commit | 709c87109dc856abff9c905dfda3ca954453828a (patch) | |
tree | daccef4bdacda74507cb46f09da6b1d36c5099d8 /libavformat/movenc.c | |
parent | ae514b1254318ae5e76be2c17055f14b4084ccf0 (diff) | |
download | ffmpeg-709c87109dc856abff9c905dfda3ca954453828a.tar.gz |
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: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 473aac0065..5452ff790c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -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); |