diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-04-09 22:10:16 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-04-13 08:49:26 +0200 |
commit | bf327ac6762dfbf17ce7c766bbcd3f86942769f6 (patch) | |
tree | df0dc09a55374a3e2f59ab2090d3aa937fb2f779 | |
parent | 16943876f87783e3c15b8bbbb609bf8c8f530f45 (diff) | |
download | ffmpeg-bf327ac6762dfbf17ce7c766bbcd3f86942769f6.tar.gz |
avcodec/hq_hqa: Check size before initializing GetByteContext
Enables the compiler to optimize the buf_size assert
in bytestream2_init() away.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/hq_hqa.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c index fd0c47cb28..c813b923b6 100644 --- a/libavcodec/hq_hqa.c +++ b/libavcodec/hq_hqa.c @@ -326,11 +326,11 @@ static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic, unsigned int data_size; int ret; - bytestream2_init(gbc, avpkt->data, avpkt->size); - if (bytestream2_get_bytes_left(gbc) < 4 + 4) { + if (avpkt->size < 4 + 4) { av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", avpkt->size); return AVERROR_INVALIDDATA; } + bytestream2_init(gbc, avpkt->data, avpkt->size); uint32_t info_tag = bytestream2_peek_le32u(gbc); if (info_tag == MKTAG('I', 'N', 'F', 'O')) { |