Commit d07d54fd authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'df33a58e'

* commit 'df33a58e':
  lavf: avoid integer overflow when estimating bitrate
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents b0ba2bf8 df33a58e
...@@ -2222,9 +2222,14 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) ...@@ -2222,9 +2222,14 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
int bit_rate = 0; int bit_rate = 0;
for(i=0;i<ic->nb_streams;i++) { for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i]; st = ic->streams[i];
if (st->codec->bit_rate > 0) 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; bit_rate += st->codec->bit_rate;
} }
}
ic->bit_rate = bit_rate; ic->bit_rate = bit_rate;
} }
......
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