Skip to content

Commit 6d9dad6

Browse files
committed
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 <[email protected]>
1 parent 83f7bd6 commit 6d9dad6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libavcodec/g2meet.c

+2
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
375375
src += 3;
376376
}
377377
npal = *src++ + 1;
378+
if (src_end - src < npal * 3)
379+
return AVERROR_INVALIDDATA;
378380
memcpy(pal, src, npal * 3); src += npal * 3;
379381
if (sub_type != 2) {
380382
for (i = 0; i < npal; i++) {

0 commit comments

Comments
 (0)