dpcm: check to make sure channels is 1 or 2.
authorJustin Ruggles <justin.ruggles@gmail.com>
Sun, 11 Sep 2011 16:40:40 +0000 (12:40 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Fri, 30 Sep 2011 22:15:53 +0000 (18:15 -0400)
libavcodec/dpcm.c

index cb128af..fc38abd 100644 (file)
@@ -117,6 +117,11 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
     int i;
     short square;
 
+    if (avctx->channels < 1 || avctx->channels > 2) {
+        av_log(avctx, AV_LOG_INFO, "invalid number of channels\n");
+        return AVERROR(EINVAL);
+    }
+
     s->channels = avctx->channels;
     s->sample[0] = s->sample[1] = 0;