diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-28 04:43:55 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-28 04:45:01 +0400 |
commit | ea9a6709a9412d55012321260f8234253c873491 (patch) | |
tree | 7abe46daa1d2058bd3f4f0e6864b89ab5d49956e /libavformat | |
parent | 1831274ff1ef69d4b730993e03283430775e2eca (diff) |
estimate_timings_from_bit_rate: Check timebase and bitrate
Fixes integer overflow and assertion failure
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index a16f2a632d..df688f1817 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2325,9 +2325,11 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) if (filesize > 0) { for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; - duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num); - if (st->duration == AV_NOPTS_VALUE) + if ( st->time_base.num <= INT64_MAX / ic->bit_rate + && st->duration == AV_NOPTS_VALUE) { + duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num); st->duration = duration; + } } } } |