int flag = 0;
int i, ret, cbp;
+ if (get_bits_left(gb) < 1)
+ return AVERROR_INVALIDDATA;
+
cbp = get_vlc2(gb, c->hqa_cbp_vlc.table, 5, 1);
for (i = 0; i < 12; i++)
int width, height, quant;
const uint8_t *src = ctx->gbc.buffer;
+ if (bytestream2_get_bytes_left(&ctx->gbc) < 8 + 4*(num_slices + 1))
+ return AVERROR_INVALIDDATA;
+
width = bytestream2_get_be16(&ctx->gbc);
height = bytestream2_get_be16(&ctx->gbc);
+ ret = ff_set_dimensions(ctx->avctx, width, height);
+ if (ret < 0)
+ return ret;
+
ctx->avctx->coded_width = FFALIGN(width, 16);
ctx->avctx->coded_height = FFALIGN(height, 16);
- ctx->avctx->width = width;
- ctx->avctx->height = height;
ctx->avctx->bits_per_raw_sample = 8;
ctx->avctx->pix_fmt = AV_PIX_FMT_YUVA422P;
int info_size;
bytestream2_skip(&ctx->gbc, 4);
info_size = bytestream2_get_le32(&ctx->gbc);
- if (bytestream2_get_bytes_left(&ctx->gbc) < info_size) {
+ if (info_size < 0 || bytestream2_get_bytes_left(&ctx->gbc) < info_size) {
av_log(avctx, AV_LOG_ERROR, "Invalid INFO size (%d).\n", info_size);
return AVERROR_INVALIDDATA;
}
return 0;
}
-AVCodec ff_hq_hqa_decoder = {
+const AVCodec ff_hq_hqa_decoder = {
.name = "hq_hqa",
.long_name = NULL_IF_CONFIG_SMALL("Canopus HQ/HQA"),
.type = AVMEDIA_TYPE_VIDEO,