[FFmpeg-cvslog] avformat/apm: Check channels

Michael Niedermayer git at videolan.org
Sun Mar 27 17:13:53 EEST 2022


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Mar 20 00:01:16 2022 +0100| [8173a6c130cae04d947fa76007cddfdc591f2583] | committer: Michael Niedermayer

avformat/apm: Check channels

Fixes: division by 0
Fixes: 45643/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4957777905188864.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8173a6c130cae04d947fa76007cddfdc591f2583
---

 libavformat/apm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/apm.c b/libavformat/apm.c
index 91eea86a57..baf7d2f941 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -140,7 +140,7 @@ static int apm_read_header(AVFormatContext *s)
     if (par->bits_per_coded_sample != 4)
         return AVERROR_INVALIDDATA;
 
-    if (channels > 2)
+    if (channels > 2 || channels == 0)
         return AVERROR_INVALIDDATA;
 
     av_channel_layout_default(&par->ch_layout, channels);



More information about the ffmpeg-cvslog mailing list