atrac1: validate number of channels
authorJustin Ruggles <justin.ruggles@gmail.com>
Fri, 14 Oct 2011 04:24:50 +0000 (00:24 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Sat, 29 Oct 2011 19:06:31 +0000 (15:06 -0400)
libavcodec/atrac1.c

index 4647e0c..1ba580c 100644 (file)
@@ -332,6 +332,11 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
 
     avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
 
+    if (avctx->channels < 1 || avctx->channels > AT1_MAX_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n",
+               avctx->channels);
+        return AVERROR(EINVAL);
+    }
     q->channels = avctx->channels;
 
     /* Init the mdct transforms */