ffmpeg | branch: release/7.0 | Michael Niedermayer <mich...@niedermayer.cc> | 
Mon Jun 17 01:08:25 2024 +0200| [ce939aa59aee1867277bd7f38ad35485386a8506] | 
committer: James Almer

avformat/iamf_parse: consider nb_substreams when accessing substreams array

Fixes: out of array access
Fixes: 
68584/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6256656668229632

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamr...@gmail.com>
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
(cherry picked from commit c69e6cccd7e14fc6ee9df179f19e9de2cecba3d8)

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

 libavformat/iamf_parse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 013bf5bba4..98854e564e 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -355,6 +355,9 @@ static int scalable_channel_layout_config(void *s, 
AVIOContext *pb,
         substream_count = avio_r8(pb);
         coupled_substream_count = avio_r8(pb);
 
+        if (substream_count + k > audio_element->nb_substreams)
+            return AVERROR_INVALIDDATA;
+
         audio_element->layers[i].substream_count         = substream_count;
         audio_element->layers[i].coupled_substream_count = 
coupled_substream_count;
         if (output_gain_is_present_flag) {

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to