From a108be2ba3732abe6976787754a50bcbee9ffba0 Mon Sep 17 00:00:00 2001 From: Manuel Lauss Date: Wed, 1 Oct 2025 18:35:02 +0200 Subject: [PATCH] avcodec/sanm: for ANIM codecs with own buffers, really check dimensions Codec37/47/48 have their own buffers; left/top are applied after the decoding is done when copying to the main buffer. Don't add left/top to their width/height when doing checks against the established buffer sizes. Signed-off-by: Manuel Lauss --- libavcodec/sanm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 5e738af698..5ccb582f38 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -1838,7 +1838,7 @@ static int process_frame_obj(SANMVideoContext *ctx, GetByteContext *gb, } } } else { - if (((left + w > ctx->width) || (top + h > ctx->height) || (w * h > ctx->buf_size)) + if (((w > ctx->width) || (h > ctx->height) || (w * h > ctx->buf_size)) && (fsc || codec == 20)) { /* correct unexpected overly large frames: this happens * for instance with The Dig's sq1.san video: it has a few