Commit 9dd04f6d authored by Michael Niedermayer's avatar Michael Niedermayer

sanm: Check dimensions before use

Fixes integer overflow and out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent ad002e1a
......@@ -732,6 +732,11 @@ static int process_frame_obj(SANMVideoContext *ctx)
w = bytestream2_get_le16u(&ctx->gb);
h = bytestream2_get_le16u(&ctx->gb);
if (!w || !h) {
av_log(ctx->avctx, AV_LOG_ERROR, "dimensions are invalid\n");
return AVERROR_INVALIDDATA;
}
if (ctx->width < left + w || ctx->height < top + h) {
if (av_image_check_size(FFMAX(left + w, ctx->width),
FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment