You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
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>
This commit is contained in:
@ -326,11 +326,11 @@ static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic,
|
|||||||
unsigned int data_size;
|
unsigned int data_size;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
bytestream2_init(gbc, avpkt->data, avpkt->size);
|
if (avpkt->size < 4 + 4) {
|
||||||
if (bytestream2_get_bytes_left(gbc) < 4 + 4) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", avpkt->size);
|
av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", avpkt->size);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
bytestream2_init(gbc, avpkt->data, avpkt->size);
|
||||||
|
|
||||||
uint32_t info_tag = bytestream2_peek_le32u(gbc);
|
uint32_t info_tag = bytestream2_peek_le32u(gbc);
|
||||||
if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
|
if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
|
||||||
|
Reference in New Issue
Block a user