Commit 15d14ce4 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/utils: Fix overflow in get_bit_rates computations

Fixes: 129ca3e28d73af7b1e24a9d4118e7a2d/signal_sigabrt_7ffff6ae7cc9_836_762b310fc3ef6087bd7771e5d8e90b9b.asf

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2de8bfd2
...@@ -1141,7 +1141,7 @@ static int64_t get_bit_rate(AVCodecContext *ctx) ...@@ -1141,7 +1141,7 @@ static int64_t get_bit_rate(AVCodecContext *ctx)
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
bits_per_sample = av_get_bits_per_sample(ctx->codec_id); bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate; bit_rate = bits_per_sample ? ctx->sample_rate * (int64_t)ctx->channels * bits_per_sample : ctx->bit_rate;
break; break;
default: default:
bit_rate = 0; bit_rate = 0;
......
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