From 0d240fa7ff9fa1ca6d23d9f6785325017282b1b5 Mon Sep 17 00:00:00 2001 From: Saxon Date: Mon, 1 Jul 2019 13:54:18 +0930 Subject: [PATCH] container/mts: checking index so that we don't go out of bounds --- container/mts/mpegts.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/container/mts/mpegts.go b/container/mts/mpegts.go index 25e36ff1..27ad6528 100644 --- a/container/mts/mpegts.go +++ b/container/mts/mpegts.go @@ -324,6 +324,9 @@ func GetPTSRange(clip []byte, pid uint16) (pts [2]uint64, err error) { // Find the first packet with PID pidType and PUSI. var i int for { + if i >= len(clip) { + return [2]uint64{}, errors.New("could not find payload start") + } pkt, _i, err := FindPid(clip[i:], pid) if err != nil { return [2]uint64{}, err