Browse code

dpcm: check to make sure channels is 1 or 2.

Justin Ruggles authored on 2011/09/12 01:40:40
Showing 1 changed files
... ...
@@ -117,6 +117,11 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
117 117
     int i;
118 118
     short square;
119 119
 
120
+    if (avctx->channels < 1 || avctx->channels > 2) {
121
+        av_log(avctx, AV_LOG_INFO, "invalid number of channels\n");
122
+        return AVERROR(EINVAL);
123
+    }
124
+
120 125
     s->channels = avctx->channels;
121 126
     s->sample[0] = s->sample[1] = 0;
122 127