summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2019-11-30 12:22:25 +0100
committerMichael Niedermayer <[email protected]>2020-07-01 13:33:44 +0200
commit634a3bb1d0f4c8bfecc6a26b1c7813820cef4ebe (patch)
tree8be88eab76353e21f1f05eb979a1269c6772a54e
parentbd61ed2c46db44b1a9630118b532744499c40bab (diff)
avcodec/iff: Check that video_size is large enough for the read parameters
video is allocated before parameters like bpp are read. Fixes: out of array access Fixes: 19084/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5718556033679360 Fixes: 19465/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5759908398235648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit f1b97f62f86d5dca35d01d7a5ebbc5dca2a88ae6) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavcodec/iff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index eac873c9da..a03f80ce53 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -322,6 +322,8 @@ static int extract_header(AVCodecContext *const avctx,
av_log(avctx, AV_LOG_ERROR, "Invalid number of bitplanes: %u\n", s->bpp);
return AVERROR_INVALIDDATA;
}
+ if (s->video_size && s->planesize * s->bpp * avctx->height > s->video_size)
+ return AVERROR_INVALIDDATA;
av_freep(&s->ham_buf);
av_freep(&s->ham_palbuf);