avformat/utils: Check bps before using it in a shift in ff_get_pcm_codec_id()
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 10 May 2016 22:00:52 +0000 (00:00 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 15 Aug 2016 16:54:34 +0000 (18:54 +0200)
Fixes undefined shift
Fixes: usan_shift

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/utils.c

index 5ee4436..d40ae64 100644 (file)
@@ -2785,6 +2785,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: