[FFmpeg-devel] [PATCH] avformat/utils: Check negative bps before shifting in ff_get_pcm_codec_id()

Michael Niedermayer michael at niedermayer.cc
Tue May 17 03:21:08 CEST 2016


On Mon, May 16, 2016 at 03:21:43PM -0700, chcunningham at chromium.org wrote:
> From: Chris Cunningham <chcunningham at chromium.org>
> 
> Fixes: undefined shift.
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5f5f03e..ad5cfa2 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2955,7 +2955,7 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
>  
>  enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
>  {
> -    if (bps > 64U)
> +    if (bps <= 0 || bps > 64U)

the U is no longer needed if < 0 is explicitly checked for

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn
-------------- 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/20160517/da42d737/attachment.sig>


More information about the ffmpeg-devel mailing list