From afbc3a1b23b3ba3e5a3f2820228a5fe51b517be7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 7 Jan 2025 23:21:32 +0100 Subject: [PATCH] avformat/mov: perform sanity checks for heif before index building Fixes: undefined NULL pointer use Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-6363211175493632 This performs equivalent sanity checks as are done in mov_read_trak() before mov_build_index() Reported-by: Dale Curtis Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 23f9993350..c016ce8e41 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -10332,7 +10332,8 @@ static int mov_parse_heif_items(AVFormatContext *s) st->codecpar->width = item->width; st->codecpar->height = item->height; - if (sc->sample_count != 1 || sc->chunk_count != 1) + err = sanity_checks(s, sc, item->item_id); + if (err) return AVERROR_INVALIDDATA; sc->sample_sizes[0] = item->extent_length;