From 1ffcd0740060eb20bc8850d3ba9e38e95f9c6b3c Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 15 Jan 2026 16:37:20 -0300 Subject: [PATCH] avcodec/mimic: check return value of init_get_bits() Fixes part of issue #21476. Signed-off-by: James Almer --- libavcodec/mimic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 2925aa50f7..08e250961e 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -399,7 +399,9 @@ static int mimic_decode_frame(AVCodecContext *avctx, AVFrame *rframe, ctx->bbdsp.bswap_buf(ctx->swap_buf, (const uint32_t *) (buf + MIMIC_HEADER_SIZE), swap_buf_size >> 2); - init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3); + res = init_get_bits8(&ctx->gb, ctx->swap_buf, swap_buf_size); + if (res < 0) + return res; res = decode(ctx, quality, num_coeffs, !is_pframe); ff_progress_frame_report(&ctx->frames[ctx->cur_index], INT_MAX);