Commit 74864186 authored by Arttu Ylä-Outinen's avatar Arttu Ylä-Outinen Committed by Luca Barbato

lavc: Make sure that the effective timebase would not overflow

In the unlikely situation the user decides to set ticks_per_frame
and timebase to a value large enough to overflow.
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent e59708bb
......@@ -1049,6 +1049,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (!avctx->rc_initial_buffer_occupancy)
avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
if (avctx->ticks_per_frame &&
avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
av_log(avctx, AV_LOG_ERROR,
"ticks_per_frame %d too large for the timebase %d/%d.",
avctx->ticks_per_frame,
avctx->time_base.num,
avctx->time_base.den);
goto free_and_end;
}
}
if (avctx->codec->init && !(avctx->active_thread_type & FF_THREAD_FRAME)) {
......
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