[FFmpeg-cvslog] avcodec/vmdvideo: Check len before using it in method 3

Michael Niedermayer git at videolan.org
Tue Jan 6 19:35:29 CET 2015


ffmpeg | branch: release/2.3 | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 16 16:24:55 2014 +0100| [942806cbe41e2d25bf1d25fa97b9fe04885afb77] | committer: Michael Niedermayer

avcodec/vmdvideo: Check len before using it in method 3

Fixes out of array access
Fixes: asan_heap-oob_4d23ba_91_cov_3853393937_128.vmd

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 3030fb7e0d41836f8add6399e9a7c7b740b48bfd)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/vmdvideo.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/vmdvideo.c b/libavcodec/vmdvideo.c
index 279c56a..42e19ae 100644
--- a/libavcodec/vmdvideo.c
+++ b/libavcodec/vmdvideo.c
@@ -339,6 +339,9 @@ static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
                         ofs += slen;
                         bytestream2_skip(&gb, len);
                     } else {
+                        if (ofs + len > frame_width ||
+                            bytestream2_get_bytes_left(&gb) < len)
+                            return AVERROR_INVALIDDATA;
                         bytestream2_get_buffer(&gb, &dp[ofs], len);
                         ofs += len;
                     }



More information about the ffmpeg-cvslog mailing list