Comcast / gots

MPEG Transport Stream handling in Go
Other
308 stars 88 forks source link

runtime panics in psi #148

Closed tmm1 closed 3 years ago

tmm1 commented 3 years ago
panic: runtime error: index out of range [2] with length 2

goroutine 180 [running]:
github.com/Comcast/gots/psi.sectionLength(...)
    github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/psi.go:74
github.com/Comcast/gots/psi.SectionLength(...)
    github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/psi.go:60
github.com/Comcast/gots/psi.pat.NumPrograms(0xc0024e60c4, 0xb8, 0xb8, 0x6ed1c5)
    github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/pat.go:77 +0xa6
github.com/Comcast/gots/psi.pat.ProgramMap(0xc0024e60c4, 0xb8, 0xb8, 0x0)
    github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/pat.go:97 +0x74
panic: runtime error: index out of range [10] with length 10

goroutine 182 [running]:
github.com/Comcast/gots/psi.(*pmt).parsePMTSection(0xc004d1a000, 0xc0012af9d4, 0xa, 0x234, 0xc004c5d1a0, 0x6f037f)
    github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/pmt.go:126 +0x7d1
github.com/Comcast/gots/psi.(*pmt).parseTables(0xc004d1a000, 0xc0012af700, 0x2e0, 0x508, 0x508, 0x0)
    github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/pmt.go:106 +0x10c
github.com/Comcast/gots/psi.NewPMT(0xc0012af700, 0x2e0, 0x508, 0x4, 0x0, 0x0, 0x0)
    github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/pmt.go:92 +0x69
tmm1 commented 3 years ago

github.com/Comcast/gots/psi.SectionLength(...) github.com/Comcast/gots@v0.0.0-20201111000122-5e29012f8ad4/psi/psi.go:60

This is from a fork that includes https://github.com/Comcast/gots/pull/145

Seems like there's an off-by-one in the check there. Will fix on that PR.