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

avformat/iamf_parse: 0 layers are not allowed

Fixes: out of array access
Fixes: 
68302/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4665793796177920

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 7fab9b97613e5ec6954fb8118f9ca43f04847cfe)

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

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

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 98854e564e..fc7b0c5362 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -330,7 +330,7 @@ static int scalable_channel_layout_config(void *s, 
AVIOContext *pb,
     nb_layers = avio_r8(pb) >> 5; // get_bits(&gb, 3);
     // skip_bits(&gb, 5); //reserved
 
-    if (nb_layers > 6)
+    if (nb_layers > 6 || nb_layers == 0)
         return AVERROR_INVALIDDATA;
 
     audio_element->layers = av_calloc(nb_layers, 
sizeof(*audio_element->layers));

_______________________________________________
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