[FFmpeg-cvslog] avcodec/hq_hqa: Check available date before allocating frame

Andreas Rheinhardt git at videolan.org
Sun Apr 13 10:01:11 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Apr  9 22:04:46 2025 +0200| [c39e23cc919b7154d7ffec4e5959cdeba79c0bb5] | committer: Andreas Rheinhardt

avcodec/hq_hqa: Check available date before allocating frame

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c39e23cc919b7154d7ffec4e5959cdeba79c0bb5
---

 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;



More information about the ffmpeg-cvslog mailing list