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 <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-06-17 01:08:26 +02:00
parent c69e6cccd7
commit 7fab9b9761
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 1 additions and 1 deletions

View File

@ -330,7 +330,7 @@ static int scalable_channel_layout_config(void *s, AVIOContext *pb,
nb_layers = avio_r8(pb) >> 5; // get_bits(&gb, 3); nb_layers = avio_r8(pb) >> 5; // get_bits(&gb, 3);
// skip_bits(&gb, 5); //reserved // skip_bits(&gb, 5); //reserved
if (nb_layers > 6) if (nb_layers > 6 || nb_layers == 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
audio_element->layers = av_calloc(nb_layers, sizeof(*audio_element->layers)); audio_element->layers = av_calloc(nb_layers, sizeof(*audio_element->layers));