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>
This commit is contained in:
Michael Niedermayer
2026-04-08 12:23:16 +02:00
committed by michaelni
parent af87d77514
commit bb69a090a7
+2 -1
View File
@@ -358,7 +358,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);