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

Michael Niedermayer git at videolan.org
Thu Dec 18 19:21:15 CET 2014


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

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

diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
index 79a33b8..773ca88 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -343,7 +343,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