aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-03-02 13:01:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-13 23:39:50 +0200
commitb70429e33c7c33eda2f0cbcf8d9fa0752bcd3c22 (patch)
treef09f0a09fa4c537f80d36c3c2693859c2068c06c
parent77f3f2aaf9bbd58aad74b373ce2ace57fd9c18a8 (diff)
downloadffmpeg-b70429e33c7c33eda2f0cbcf8d9fa0752bcd3c22.tar.gz
avformat/mov: Disallow empty sidx
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 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4419433d77278cb742944c4514be5f72a04103c0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mov.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 78ec7e8f45..5bbc54493e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4586,7 +4586,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
index->track_id = track_id;
index->item_count = avio_rb16(pb);
- index->items = av_mallocz_array(index->item_count, sizeof(MOVFragmentIndexItem));
+ index->items = index->item_count ? av_mallocz_array(index->item_count, sizeof(MOVFragmentIndexItem)) : NULL;
if (!index->items) {
av_freep(&index);