grafov / m3u8

Parser and generator of M3U8-playlists for Apple HLS. Library for Go language. :cinema:
http://tools.ietf.org/html/draft-pantos-http-live-streaming
BSD 3-Clause "New" or "Revised" License
1.24k stars 318 forks source link

Decoding MediaPlaylist panics with error: index out of range [0] with length 0 #197

Closed hasc closed 1 year ago

hasc commented 1 year ago

Hello,

many thanks for sharing this library!

Since version v0.11.2 decoding a MediaPlaylist panics with the error message: "index out of range [0] with length 0"

Steps to reproduce:

const manifest = `#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:419978785
#EXT-X-VERSION:3
#EXT-X-KEY:METHOD=NONE
#EXTINF:4,
path/to/segment_419978785.ts
#EXTINF:4,
path/to/segment_419978786.ts
#EXTINF:4,
path/to/segment_419978787.ts
#EXTINF:4,
path/to/segment_419978788.ts
#EXTINF:4,
path/to/segment_419978789.ts
`
_, _, err := m3u8.DecodeFrom(strings.NewReader(manifest), true)
coder-free commented 1 year ago

go get -u github.com/grafov/m3u8@master master it fixed.

grafov commented 1 year ago

Thank you. I set up tags properly. Latest version where the bug was fixed is v0.11.3.