[FFmpeg-cvslog] avformat/aiffdec: Check for previously set channels

Michael Niedermayer git at videolan.org
Wed Apr 3 15:44:12 EEST 2024


ffmpeg | branch: release/7.0 | Michael Niedermayer <michael at niedermayer.cc> | Fri Mar 22 23:07:01 2024 +0100| [8194f34b5d4fb098ff88b213a0148b748209ad99] | committer: Michael Niedermayer

avformat/aiffdec: Check for previously set channels

Fixes: out of array access (av_channel_layout_copy())
Fixes: 67087/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-4920720268263424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 23b29f72eeb2ff6f2176ee74b9abe78aec4cd1f4)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/aiffdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 9318943f96..fc01ffcbf1 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -106,6 +106,8 @@ static int get_aiff_header(AVFormatContext *s, int64_t size,
         size++;
     par->codec_type = AVMEDIA_TYPE_AUDIO;
     channels = avio_rb16(pb);
+    if (par->ch_layout.nb_channels && par->ch_layout.nb_channels != channels)
+        return AVERROR_INVALIDDATA;
     par->ch_layout.nb_channels = channels;
     num_frames = avio_rb32(pb);
     par->bits_per_coded_sample = avio_rb16(pb);



More information about the ffmpeg-cvslog mailing list