aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-11 21:18:58 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commitd88e50ed615b5edcfa49cd6e83bcdfd0757fce29 (patch)
tree8d6e167e88f8f7b6ef13623131d4e3ecf3c8ff5d
parent44710253f473fda123e7d05b96f09f3d641d5b28 (diff)
downloadffmpeg-d88e50ed615b5edcfa49cd6e83bcdfd0757fce29.tar.gz
avcodec/iff: Test video_size being non zero
Fixes: Out of array access Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5658548592967680 Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723561177382912 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 a035fd88ae7341a05c01f3b393921933e4ea9665) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/iff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index c5c6dceb20..f77b30aada 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -440,6 +440,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (avctx->codec_tag == MKTAG('A', 'N', 'I', 'M')) {
s->video_size = FFALIGN(avctx->width, 2) * avctx->height * s->bpp;
+ if (!s->video_size)
+ return AVERROR_INVALIDDATA;
s->video[0] = av_calloc(FFALIGN(avctx->width, 2) * avctx->height, s->bpp);
s->video[1] = av_calloc(FFALIGN(avctx->width, 2) * avctx->height, s->bpp);
s->pal = av_calloc(256, sizeof(*s->pal));