wavpack: validate samples size parsed in wavpack_decode_block
authorLuca Barbato <lu_zero@gentoo.org>
Fri, 17 May 2013 16:29:15 +0000 (18:29 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 18 May 2013 18:39:32 +0000 (20:39 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/wavpack.c

index 38fc26b..8d7c82b 100644 (file)
@@ -796,6 +796,9 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
     if (!wc->mkv_mode) {
         s->samples = AV_RL32(buf);
         buf       += 4;
+        if (s->samples != wc->samples)
+            return AVERROR_INVALIDDATA;
+
         if (!s->samples) {
             *got_frame_ptr = 0;
             return 0;