avcodec/tdsc: Check tile_size

Fixes: out of array read
Fixes: tdsc_war_groom_far4096.avi

Found by: Ante Silovic <asilovic155@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e9e6fb8798)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-04-08 11:17:47 +02:00
parent 082f6ddb5c
commit baf0b00ef7
+3
View File
@@ -436,6 +436,9 @@ static int tdsc_decode_tiles(AVCodecContext *avctx, int number_tiles)
if (ret < 0)
return ret;
} else if (tile_mode == MKTAG(' ','W','A','R')) {
if (3LL * w * h > tile_size)
return AVERROR_INVALIDDATA;
/* Just copy the buffer to output */
av_image_copy_plane(ctx->refframe->data[0] + x * 3 +
ctx->refframe->linesize[0] * y,