[FFmpeg-devel] [PATCH 2/2] avformat/mov: perform sanity checks for heif before index building

Michael Niedermayer michael at niedermayer.cc
Thu Jan 9 01:17:44 EET 2025


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 <dalecurtis at chromium.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/mov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8006bda7a1c..f3cef40a6ab 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -10414,7 +10414,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;
-- 
2.47.0



More information about the ffmpeg-devel mailing list