avcodec/sanm: enforce SANM min and max sizes at decode_init()

Enforce at least 8x8 and at max 800x600 for SANM/BL16.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
This commit is contained in:
Manuel Lauss
2025-09-22 09:56:00 +02:00
parent 70b04717d0
commit 556cef27d9

View File

@@ -639,6 +639,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
// ANIM has no dimensions in the header, distrust the incoming data.
avctx->width = avctx->height = 0;
ctx->have_dimensions = 0;
} else if (avctx->width > 800 || avctx->height > 600 ||
avctx->width < 8 || avctx->height < 8) {
// BL16 valid range is 8x8 - 800x600
return AVERROR_INVALIDDATA;
}
init_sizes(ctx, avctx->width, avctx->height);
if (init_buffers(ctx)) {