Commit 9fac2437 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/cfhd: Check that cropped size is smaller than full

Fixes: signed integer overflow: 57342 * 120830 cannot be represented in type 'int'
Fixes: 16426/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5758744817827840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
parent 305f6dbb
...@@ -625,8 +625,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -625,8 +625,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height); ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (s->cropped_height) if (s->cropped_height) {
avctx->height = s->cropped_height << (avctx->pix_fmt == AV_PIX_FMT_BAYER_RGGB16); unsigned height = s->cropped_height << (avctx->pix_fmt == AV_PIX_FMT_BAYER_RGGB16);
if (avctx->height < height)
return AVERROR_INVALIDDATA;
avctx->height = height;
}
frame.f->width = frame.f->width =
frame.f->height = 0; frame.f->height = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment