[FFmpeg-devel] [PATCH] libavcodec/util: Fix timebase overflow check

Michael Niedermayer michael at niedermayer.cc
Wed Jan 27 23:03:06 CET 2016


On Wed, Jan 27, 2016 at 09:13:19PM +0000, Derek Buitenhuis wrote:
> It could accidentally divide by zero if num was zero.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 13ee243..491d8ea 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1475,7 +1475,7 @@ 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 &&
> +        if (avctx->ticks_per_frame && avctx->time_base.num &&

is the avctx->ticks_per_frame != 0 check needed?

LGTM with or without the ticks_per_frame check


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160127/6f21f53f/attachment.sig>


More information about the ffmpeg-devel mailing list