OSDN Git Service

wavpack: check that there aren't too many blocks per packet
authorAnton Khirnov <anton@khirnov.net>
Mon, 27 May 2013 17:11:09 +0000 (19:11 +0200)
committerAnton Khirnov <anton@khirnov.net>
Tue, 28 May 2013 15:47:17 +0000 (17:47 +0200)
libavcodec/wavpack.c

index 9c766ca..7a14519 100644 (file)
@@ -1120,6 +1120,11 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
         }
     }
 
+    if (wc->ch_offset + s->stereo >= avctx->channels) {
+        av_log(avctx, AV_LOG_WARNING, "Too many channels coded in a packet.\n");
+        return (avctx->err_recognition & AV_EF_EXPLODE) ? AVERROR_INVALIDDATA : 0;
+    }
+
     samples_l = frame->extended_data[wc->ch_offset];
     if (s->stereo)
         samples_r = frame->extended_data[wc->ch_offset + 1];