Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit
dd0bfc3a6a310e3e3674ce7742672d689a9a0e93)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
while (src < src_end && dst < dst_end) {
code = *src++;
if (code & 0x80) {
+ if (src >= src_end)
+ break;
len = code - 0x7F;
memset(dst, *src++, FFMIN(len, dst_end - dst));
} else {
len = code + 1;
- memcpy(dst, src, FFMIN(len, dst_end - dst));
+ memcpy(dst, src, FFMIN3(len, dst_end - dst, src_end - src));
src += len;
}
dst += len;