avcodec/tdsc: Check jpeg size

Fixes: out of array read
Fixes: tdsc_tile_dim_mismatch.avi

Found-by: Ante Silovic <asilovic155@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bb69a090a7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-04-08 12:23:16 +02:00
parent 1c32efde4b
commit 3375dc11e2
+2 -1
View File
@@ -359,7 +359,8 @@ static int tdsc_decode_jpeg_tile(AVCodecContext *avctx, int tile_size,
}
ret = avcodec_receive_frame(ctx->jpeg_avctx, ctx->jpgframe);
if (ret < 0 || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P) {
if (ret < 0 || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P ||
w > ctx->jpgframe->width || h > ctx->jpgframe->height) {
av_log(avctx, AV_LOG_ERROR,
"JPEG decoding error (%d).\n", ret);