diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-16 16:24:55 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-16 19:43:41 +0100 |
commit | 0da0d7754e745d066f845da499383ff86d2ce04f (patch) | |
tree | 295b1e579d56847f23ea4a493f71daeb5d92ee9b | |
parent | c03491d96b89107698fa460fa6cfbe53a7fbd66c (diff) | |
download | ffmpeg-0da0d7754e745d066f845da499383ff86d2ce04f.tar.gz |
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@gmx.at>
(cherry picked from commit 3030fb7e0d41836f8add6399e9a7c7b740b48bfd)
Conflicts:
libavcodec/vmdvideo.c
-rw-r--r-- | libavcodec/vmdav.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 79a33b867f..773ca886a3 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); } |