diff mbox series

[FFmpeg-devel,4/9] avformat/iamf_parse: Layer, thou shalt not be 0

Message ID 20240616230831.912377-4-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/9] avcodec/targaenc: Allocate space for the palette | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Michael Niedermayer June 16, 2024, 11:08 p.m. UTC
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
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/iamf_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer June 18, 2024, 12:33 a.m. UTC | #1
On 6/16/2024 8:08 PM, Michael Niedermayer wrote:
> 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
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>   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 5c2ff6862a7..12c2b9533a8 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));

LGMT, but please change the commit message.
Michael Niedermayer June 19, 2024, 10:57 a.m. UTC | #2
On Mon, Jun 17, 2024 at 09:33:59PM -0300, James Almer wrote:
> On 6/16/2024 8:08 PM, Michael Niedermayer wrote:
> > 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
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >   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 5c2ff6862a7..12c2b9533a8 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));
> 
> LGMT, but please change the commit message.

just change ?
as in "to anything i feel like" ? :)

ok

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 5c2ff6862a7..12c2b9533a8 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));