From 62785291fe84cb278433e349d26158db8d8a748a Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Thu, 9 Dec 2021 13:00:10 +0100 Subject: [PATCH] mp4: fuzz: Make sure stsz has sane number of entries on constant sample size Should be redone to not use an array --- format/mp4/boxes.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/format/mp4/boxes.go b/format/mp4/boxes.go index 9cc4a06e..02e85d0e 100644 --- a/format/mp4/boxes.go +++ b/format/mp4/boxes.go @@ -539,6 +539,11 @@ func init() { }) } else { if ctx.currentTrack != nil { + // TODO: keep track of list of sampleSize/entries instead and change sample read code + const maxEntryCount = 10_000_000 + if entryCount > maxEntryCount { + d.Errorf("too many constant stsz entries %d > %d", entryCount, maxEntryCount) + } for i := uint64(0); i < entryCount; i++ { ctx.currentTrack.stsz = append(ctx.currentTrack.stsz, uint32(sampleSize)) }