diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-08-04 12:03:35 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-08-05 17:54:24 +0200 |
commit | 58e084bd2c7bad8934e0c4eaf40e319927dae729 (patch) | |
tree | 936b69bc6e83c86084267a21d46010b82b71f2d3 | |
parent | fe2e1cfc191d48c45f51feb61fa198a2403931c2 (diff) | |
download | ffmpeg-58e084bd2c7bad8934e0c4eaf40e319927dae729.tar.gz |
avcodec/cfhd: Check destination space for bayer before writing
Fixes: out of array write
Fixes: 16105/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5690817309573120
Fixes: 16119/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5099050675732480
Fixes: 16135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5705501601431552
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/cfhd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index a162fc7da3..27eed415d1 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -963,6 +963,15 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } low = s->plane[plane].l_h[6]; high = s->plane[plane].l_h[7]; + + if (avctx->pix_fmt == AV_PIX_FMT_BAYER_RGGB16 && + (lowpass_height * 2 > avctx->coded_height / 2 || + lowpass_width * 2 > avctx->coded_width / 2 ) + ) { + ret = AVERROR_INVALIDDATA; + goto end; + } + for (i = 0; i < lowpass_height * 2; i++) { if (avctx->pix_fmt == AV_PIX_FMT_BAYER_RGGB16) horiz_filter_clip_bayer(dst, low, high, lowpass_width, s->bpc); |