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 <manuel.lauss@gmail.com>
This commit is contained in:
Manuel Lauss
2025-10-01 18:35:02 +02:00
parent b6a9c4671a
commit a108be2ba3

View File

@@ -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