[FFmpeg-devel] [PATCH 1/3] avcodec/fastaudio: Check channels

Michael Niedermayer michael at niedermayer.cc
Wed Sep 9 00:29:19 EEST 2020


Fixes: division by 0
Fixes: 25419/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-5632544761184256
Fixes: 25433/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-6215671900536832

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/fastaudio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c
index de006acd9b..34857d1b88 100644
--- a/libavcodec/fastaudio.c
+++ b/libavcodec/fastaudio.c
@@ -41,6 +41,9 @@ static av_cold int fastaudio_init(AVCodecContext *avctx)
 {
     FastAudioContext *s = avctx->priv_data;
 
+    if (avctx->channels <= 0)
+        return AVERROR_INVALIDDATA;
+
     avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
 
     for (int i = 0; i < 8; i++)
-- 
2.17.1



More information about the ffmpeg-devel mailing list