1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/g2meet: check available space before copying palette

Fixes out of array read
Fixes: asan_heap-uaf_ae6067_5415_g2m4.wmv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-11-26 21:53:47 +01:00
parent 83f7bd6dcf
commit 6d9dad6a7c

View File

@ -375,6 +375,8 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
src += 3; src += 3;
} }
npal = *src++ + 1; npal = *src++ + 1;
if (src_end - src < npal * 3)
return AVERROR_INVALIDDATA;
memcpy(pal, src, npal * 3); src += npal * 3; memcpy(pal, src, npal * 3); src += npal * 3;
if (sub_type != 2) { if (sub_type != 2) {
for (i = 0; i < npal; i++) { for (i = 0; i < npal; i++) {