[FFmpeg-devel] [PATCH] avformat/mov: Disallow empty sidx

Michael Niedermayer michael at niedermayer.cc
Wed Mar 2 16:01:24 EET 2022


It appears this is not allowed "Each Segment Index box documents how a (sub)segment is divided into one or more subsegments
(which may themselves be further subdivided using Segment Index boxes)."
Fixes: Null pointer dereference
Fixes: Ticket9517

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/mov.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5e26267810..68b6d7f075 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5118,6 +5118,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     avio_rb16(pb); // reserved
 
     item_count = avio_rb16(pb);
+    if (item_count == 0)
+        return AVERROR_INVALIDDATA;
 
     for (i = 0; i < item_count; i++) {
         int index;
-- 
2.17.1



More information about the ffmpeg-devel mailing list