wavpack: check packet size early
authorLuca Barbato <lu_zero@gentoo.org>
Wed, 22 May 2013 10:51:42 +0000 (12:51 +0200)
committerReinhard Tartler <siretart@tauware.de>
Sat, 22 Jun 2013 06:51:56 +0000 (08:51 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit fd06291239c1bb616bf303b5696cc432710b2530)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/wavpack.c

index 7ceb947adb2b514e2c5d3791e19c1aae30bfa442..59d735fab57e5ab3e1eb0bcc3f620a77aad3fddb 100644 (file)
@@ -1171,6 +1171,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;