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>
This commit is contained in:
Michael Niedermayer 2022-03-02 13:01:53 +01:00
parent add3571a59
commit 4419433d77
1 changed files with 2 additions and 0 deletions

View File

@ -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;