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

James Almer git at videolan.org
Mon Jul 29 02:46:02 EEST 2024


ffmpeg | branch: release/7.0 | James Almer <jamrial at gmail.com> | Fri Jun 28 21:06:53 2024 -0300| [d517a84c85ae695085f3d0ea25156b68fafe7356] | committer: James Almer

avformat/mov: check that sample and chunk count is 1 for HEIF

Fixes NULL pointer dereference in broken/fuzzed streams.

Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 2aa63784b533f461785c3e767e354e84c7e2c8c2)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d517a84c85ae695085f3d0ea25156b68fafe7356
---

 libavformat/mov.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 83a48335ac..a6732ad3e0 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -9574,6 +9574,9 @@ 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;
 



More information about the ffmpeg-cvslog mailing list