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

Michael Niedermayer git at videolan.org
Thu Mar 12 00:52:51 CET 2015


ffmpeg | branch: release/0.7 | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 16 16:24:55 2014 +0100| [fac6f744d8170585f05e098ce9c9f27eeffa818e] | 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)

Conflicts:

	libavcodec/vmdvideo.c

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

 libavcodec/vmdav.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
index 1f9694e..94ae895 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -339,7 +339,7 @@ static void vmd_decode(VmdVideoContext *s)
                         if (*pb++ == 0xFF)
                             len = rle_unpack(pb, pb_end - pb, len, &dp[ofs], frame_width - ofs);
                         else {
-                        if (pb_end - pb < len)
+                        if (ofs + len > frame_width || pb_end - pb < len)
                             return;
                             memcpy(&dp[ofs], pb, len);
                         }



More information about the ffmpeg-cvslog mailing list