]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pcm.c
fix lowres decoding support on ARM CPUs
[ffmpeg] / libavcodec / pcm.c
index 560e2e38842a585183872b282da002888aab58a4..c7a7e82477773ccc5c330448ca5a32afb383d7cf 100644 (file)
@@ -384,10 +384,14 @@ static int pcm_decode_frame(AVCodecContext *avctx,
     src = buf;
 
     n= av_get_bits_per_sample(avctx->codec_id)/8;
-    if((n && buf_size % n) || avctx->channels > MAX_CHANNELS){
+    if(n && buf_size % n){
         av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
         return -1;
     }
+    if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
+        av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
+        return -1;
+    }
 
     buf_size= FFMIN(buf_size, *data_size/2);
     *data_size=0;