Commit 8c2bb10d authored by Vitaly Buka's avatar Vitaly Buka Committed by Michael Niedermayer

avcodec/utils: Fix signed integer overflow in rc_initial_buffer_occupancy initialization

Signed integer overflow is undefined behavior.
Detected with clang and -fsanitize=signed-integer-overflow
Signed-off-by: 's avatarVitaly Buka <vitalybuka@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent f3913dcc
...@@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
} }
if (!avctx->rc_initial_buffer_occupancy) if (!avctx->rc_initial_buffer_occupancy)
avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;
if (avctx->ticks_per_frame && avctx->time_base.num && if (avctx->ticks_per_frame && avctx->time_base.num &&
avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) { avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
......
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