[FFmpeg-devel] [PATCH] avcodec/dsddec: Check channels

Michael Niedermayer michael at niedermayer.cc
Mon May 4 23:10:00 EEST 2020


Fixes: division by zero
Fixes: 21677/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSD_MSBF_fuzzer-5712547983654912

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/dsddec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c
index 7c3ae15768..39837a5ad9 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);
-- 
2.17.1



More information about the ffmpeg-devel mailing list