mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-09 01:21:06 +00:00
avformat/iamf_parse: check that num_sub_mixes and num_audio_elements in Mix Presentations are not zero
As required by the spec in Section 3.7
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1b946a3abd)
This commit is contained in:
@@ -1042,6 +1042,12 @@ static int mix_presentation_obu(void *s, IAMFContext *c, AVIOContext *pb, int le
|
||||
}
|
||||
|
||||
nb_submixes = ffio_read_leb(pbc);
|
||||
if (!nb_submixes) {
|
||||
av_log(s, AV_LOG_ERROR, "Mix presentation %u has no submixes\n", mix_presentation_id);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (int i = 0; i < nb_submixes; i++) {
|
||||
AVIAMFSubmix *sub_mix;
|
||||
unsigned nb_elements, nb_layouts;
|
||||
@@ -1053,6 +1059,13 @@ static int mix_presentation_obu(void *s, IAMFContext *c, AVIOContext *pb, int le
|
||||
}
|
||||
|
||||
nb_elements = ffio_read_leb(pbc);
|
||||
if (!nb_elements) {
|
||||
av_log(s, AV_LOG_ERROR, "Submix %d from Mix presentation %u has no audio elements\n",
|
||||
i, mix_presentation_id);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (int j = 0; j < nb_elements; j++) {
|
||||
AVIAMFSubmixElement *submix_element;
|
||||
IAMFAudioElement *audio_element = NULL;
|
||||
|
||||
Reference in New Issue
Block a user