wavpack: check packet size early
authorLuca Barbato <lu_zero@gentoo.org>
Wed, 22 May 2013 10:51:42 +0000 (12:51 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Wed, 22 May 2013 20:02:57 +0000 (22:02 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/wavpack.c

index cfcd22d..e6e9872 100644 (file)
@@ -1203,6 +1203,9 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
     int frame_size, ret, frame_flags;
     int samplecount = 0;
 
+    if (avpkt->size < 12 + s->multichannel * 4)
+        return AVERROR_INVALIDDATA;
+
     s->block     = 0;
     s->ch_offset = 0;