[FFmpeg-cvslog] avformat/utils: Check bps before using it in a shift in ff_get_pcm_codec_id()

Michael Niedermayer git at videolan.org
Sun Jun 5 03:16:41 CEST 2016


ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Wed May 11 00:00:52 2016 +0200| [79181b97d477386e26bd1d4d476b33376f194c96] | committer: Michael Niedermayer

avformat/utils: Check bps before using it in a shift in ff_get_pcm_codec_id()

Fixes undefined shift
Fixes: usan_shift

Found-by: Thomas Guilbert <tguilbert at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit ea791c080dd5494b3bee0c618a3f52e371b5f320)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79181b97d477386e26bd1d4d476b33376f194c96
---

 libavformat/utils.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3aa5beb..9fa7443 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2833,6 +2833,9 @@ 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)
+        return AV_CODEC_ID_NONE;
+
     if (flt) {
         switch (bps) {
         case 32:



More information about the ffmpeg-cvslog mailing list