[FFmpeg-cvslog] avcodec/mpeg4videodec: Check for bitstream overread in decode_vol_header()

Michael Niedermayer git at videolan.org
Thu Feb 20 06:01:34 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Feb 20 05:48:54 2014 +0100| [3edc3b159503d512c919b3d5902f7026e961823a] | committer: Michael Niedermayer

avcodec/mpeg4videodec: Check for bitstream overread in decode_vol_header()

Fixes out of array read
Fixes: 08e48e9daae7d8f8ab6dbe3919e797e5-asan_heap-oob_157461c_5295_cov_1266798650_firefing.mpg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3edc3b159503d512c919b3d5902f7026e961823a
---

 libavcodec/mpeg4videodec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 22e706e..a1f530c 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1916,6 +1916,11 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
         else
             s->quarter_sample = 0;
 
+        if (get_bits_left(gb) < 4) {
+            av_log(s->avctx, AV_LOG_ERROR, "VOL Header truncated\n");
+            return AVERROR_INVALIDDATA;
+        }
+
         if (!get_bits1(gb)) {
             int pos               = get_bits_count(gb);
             int estimation_method = get_bits(gb, 2);



More information about the ffmpeg-cvslog mailing list