binkaudio: check number of channels
authorPaul B Mahol <onemda@gmail.com>
Thu, 31 May 2012 08:58:31 +0000 (08:58 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Jun 2012 19:07:22 +0000 (21:07 +0200)
Fixes #1380.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 824a6975ee066e944b7a20d1e220fd8974fb6174)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/binkaudio.c

index 3b65a19..a93131d 100644 (file)
@@ -85,9 +85,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
         frame_len_bits = 11;
     }
 
-    if (avctx->channels > MAX_CHANNELS) {
-        av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels);
-        return -1;
+    if (avctx->channels < 1 || avctx->channels > MAX_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n", avctx->channels);
+        return AVERROR_INVALIDDATA;
     }
 
     if (avctx->extradata && avctx->extradata_size > 0)