]> git.sesse.net Git - ffmpeg/commitdiff
h264: prevent overreads in intra PCM decoding.
authorRonald S. Bultje <rsbultje@gmail.com>
Wed, 29 Feb 2012 02:48:27 +0000 (18:48 -0800)
committerRonald S. Bultje <rsbultje@gmail.com>
Wed, 29 Feb 2012 21:17:34 +0000 (13:17 -0800)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/h264_cabac.c

index 75fb02cb631345c67955da06f0d7d0d508db6a4b..2ee4bc01a84f0d8ab9886c110d6f7a7cd6a3d618 100644 (file)
@@ -1996,6 +1996,8 @@ decode_intra_mb:
         }
 
         // The pixels are stored in the same order as levels in h->mb array.
+        if ((int) (h->cabac.bytestream_end - ptr) < mb_size)
+            return -1;
         memcpy(h->mb, ptr, mb_size); ptr+=mb_size;
 
         ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);