From c39e23cc919b7154d7ffec4e5959cdeba79c0bb5 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Wed, 9 Apr 2025 22:04:46 +0200 Subject: [PATCH] avcodec/hq_hqa: Check available date before allocating frame Signed-off-by: Andreas Rheinhardt --- libavcodec/hq_hqa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c index c849b52073..0baec67136 100644 --- a/libavcodec/hq_hqa.c +++ b/libavcodec/hq_hqa.c @@ -149,6 +149,9 @@ static int hq_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, av_log(ctx->avctx, AV_LOG_VERBOSE, "HQ Profile %d\n", prof_num); } + if (bytestream2_get_bytes_left(gbc) < 3 * (profile->num_slices + 1)) + return AVERROR_INVALIDDATA; + ctx->avctx->coded_width = FFALIGN(profile->width, 16); ctx->avctx->coded_height = FFALIGN(profile->height, 16); ctx->avctx->width = profile->width;