diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-06-29 21:53:09 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-08 11:51:38 +0200 |
commit | 3e3db69193809d5c1844b0e49f9f8da181492133 (patch) | |
tree | c6743b84cf20a3abb0f6f836c84641a9a7604d24 /libavcodec | |
parent | 16f8e50f86ce6c9944f31045dae9639baaadf444 (diff) | |
download | ffmpeg-3e3db69193809d5c1844b0e49f9f8da181492133.tar.gz |
avcodec/hq_hqa: Use ff_set_dimensions()
Fixes: 15530/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-5637370344374272
Fixes: signed integer overflow: 65312 * 65312 cannot be represented in type 'int'
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a6229fcd405d4135848c83df73634871260de59c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/hq_hqa.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c index 90bafdc72a..eec2e980b3 100644 --- a/libavcodec/hq_hqa.c +++ b/libavcodec/hq_hqa.c @@ -254,10 +254,12 @@ static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, size_t data_size) 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; |