diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-08 14:14:33 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-08 14:29:07 +0400 |
commit | 53fb52ac859c1c1f81a87336b1f40ac6226b3976 (patch) | |
tree | b3b05345ab87065c87a4fd3a6652b0fe19259254 | |
parent | 13e35a25f6703a68cfede58e5e6ae455caaee8c3 (diff) | |
parent | 26f027fba1c5ab482fa2488fbe0fa36c8bb33b69 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
lavf: fix the comparison in an overflow check
Conflicts:
libavformat/utils.c
See: a5d67bc796e1f9a2b99b43ea807166b655e4bdbc
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/utils.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index b12d5b8694..4d4b701baa 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2220,15 +2220,18 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) /* if bit_rate is already set, we believe it */ if (ic->bit_rate <= 0) { - int64_t bit_rate = 0; + int bit_rate = 0; for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->codec->bit_rate > 0) { + if (INT_MAX - st->codec->bit_rate < bit_rate) { + bit_rate = 0; + break; + } bit_rate += st->codec->bit_rate; } } - if (bit_rate <= INT_MAX) - ic->bit_rate = bit_rate; + ic->bit_rate = bit_rate; } /* if duration is already set, we believe it */ |