mirror of https://git.ffmpeg.org/ffmpeg.git
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 3030fb7e0d
)
Conflicts:
libavcodec/vmdav.c
This commit is contained in:
parent
adf2f2166e
commit
87ec3c6156
|
@ -319,8 +319,12 @@ static void vmd_decode(VmdVideoContext *s)
|
||||||
len = rle_unpack(gb.buffer, &dp[ofs],
|
len = rle_unpack(gb.buffer, &dp[ofs],
|
||||||
len, bytestream2_get_bytes_left(&gb),
|
len, bytestream2_get_bytes_left(&gb),
|
||||||
frame_width - ofs);
|
frame_width - ofs);
|
||||||
else
|
else {
|
||||||
|
if (ofs + len > frame_width ||
|
||||||
|
bytestream2_get_bytes_left(&gb) < len)
|
||||||
|
return;
|
||||||
bytestream2_get_buffer(&gb, &dp[ofs], len);
|
bytestream2_get_buffer(&gb, &dp[ofs], len);
|
||||||
|
}
|
||||||
bytestream2_skip(&gb, len);
|
bytestream2_skip(&gb, len);
|
||||||
} else {
|
} else {
|
||||||
/* interframe pixel copy */
|
/* interframe pixel copy */
|
||||||
|
|
Loading…
Reference in New Issue