aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dsddec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-04 00:04:49 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-05-21 15:32:28 +0200
commit219c025463c4e5634129b73a72a13e0f6ab70150 (patch)
tree02fc77e70a544b6210c2ea4246734201ae927784 /libavcodec/dsddec.c
parent53bfdb6fdb3686e6b65e3f94704ab137af992d09 (diff)
downloadffmpeg-219c025463c4e5634129b73a72a13e0f6ab70150.tar.gz
avcodec/dsddec: Check channels
Fixes: division by zero Fixes: 21677/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSD_MSBF_fuzzer-5712547983654912 Fixes: 21751/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSD_LSBF_fuzzer-5197097180856320 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 2570a8777e7095358b10f679d35641e114a2ab33) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dsddec.c')
-rw-r--r--libavcodec/dsddec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c
index 2c5c357acc..a2e038419f 100644
--- a/libavcodec/dsddec.c
+++ b/libavcodec/dsddec.c
@@ -44,6 +44,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
int i;
uint8_t silence;
+ if (!avctx->channels)
+ return AVERROR_INVALIDDATA;
+
ff_init_dsd_data();
s = av_malloc_array(sizeof(DSDContext), avctx->channels);