[FFmpeg-devel] [PATCH 1/2] avformat/mov: check that sample and chunk count is 1 for HEIF

James Almer jamrial at gmail.com
Sat Jun 29 03:06:53 EEST 2024


Fixes NULL pointer dereference in broken/fuzzed streams.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/mov.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 14f43bf906..ba5f85e7e3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -9904,6 +9904,8 @@ static int mov_read_header(AVFormatContext *s)
             st->codecpar->width  = item->width;
             st->codecpar->height = item->height;
 
+            if (sc->sample_count != 1 || sc->chunk_count != 1)
+                return AVERROR_INVALIDDATA;
             sc->sample_sizes[0]  = item->extent_length;
             sc->chunk_offsets[0] = item->extent_offset + offset;
 
-- 
2.45.2



More information about the ffmpeg-devel mailing list