]> git.sesse.net Git - ffmpeg/commitdiff
wmadec: Verify bitstream size makes sense before calling init_get_bits.
authorAlex Converse <alex.converse@gmail.com>
Fri, 27 Jan 2012 22:24:07 +0000 (14:24 -0800)
committerAlex Converse <alex.converse@gmail.com>
Mon, 30 Jan 2012 18:54:24 +0000 (10:54 -0800)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
libavcodec/wmadec.c

index 5600f9ba90d176ed94f5223063396c2a91cf8d6b..41b2a8e7a7bc072ece419109a6fb490fdb1461d3 100644 (file)
@@ -873,6 +873,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
 
         /* read each frame starting from bit_offset */
         pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3;
+        if (pos >= MAX_CODED_SUPERFRAME_SIZE * 8)
+            return AVERROR_INVALIDDATA;
         init_get_bits(&s->gb, buf + (pos >> 3), (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3))*8);
         len = pos & 7;
         if (len > 0)