avformat/utils: Check negative bps before shifting in ff_get_pcm_codec_id()
authorChris Cunningham <chcunningham@chromium.org>
Tue, 17 May 2016 18:28:32 +0000 (11:28 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 5 Jun 2016 00:40:31 +0000 (02:40 +0200)
Fixes: undefined shift.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2875745d354ab0ebc4af1ebaca5c5a8d26ccdc03)

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

index 054cada..7ed21b6 100644 (file)
@@ -2833,7 +2833,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 > 64)
         return AV_CODEC_ID_NONE;
 
     if (flt) {