We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x0 pc=0x3efcb] goroutine 1 [running]: github.com/grafov/m3u8.decodeLineOfMediaPlaylist(0x20821e7e0, 0x20827a000, 0x208256000, 0x0, 0x0, 0x1, 0x0, 0x0) /Users/iivari/go/src/github.com/grafov/m3u8/reader.go:478 +0x2b0b
how to reproduce:
main.go:
package main import ( "github.com/grafov/m3u8" "os" "bufio" ) func main() { m3u8.DecodeFrom(bufio.NewReader(os.Stdin), true) }
test.m3u8:
#EXTM3U #EXT-X-VERSION:2 #EXT-X-TARGETDURATION:9 #EXT-X-KEY:METHOD=AES-128,URI="http://localhost:20001/key?ecm=AAAAAQAAOpgCAAHFYAaVFH6QrFv2wYU1lEaO2L3fGQB1%2FR3oaD9auWtXNAmcVLxgRTvRlHpqHgXX1YY00%2FpdUiOlgONVbViqou2%2FItyDOWc%3D",IV=0X00000000000000000000000000000000
$cat test.m3u8 | go run main.go
After debbugging this for a while I came up with the following fix:
diff --git a/reader.go b/reader.go index 770d97f..4b58054 100644 --- a/reader.go +++ b/reader.go @@ -163,6 +163,11 @@ func decode(buf *bytes.Buffer, strict bool) (Playlist, ListType, error) { break } + // possible fix... + if len(line) < 1 { + break + } + err = decodeLineOfMasterPlaylist(master, state, line, strict) if strict && err != nil { return master, state.listType, err
The text was updated successfully, but these errors were encountered:
Blank lines should be ignored so instead of break there should be continue (http://tools.ietf.org/html/draft-pantos-http-live-streaming-12#section-3.1). That would solve this problem and also not decode any blank lines in the buffer.
break
continue
Sorry, something went wrong.
6acbc3b
Merge pull request #26 from iivarih/issues-25
5a6b6c2
Fixes decoding empty lines, partially closes #25
No branches or pull requests
how to reproduce:
main.go:
test.m3u8:
$cat test.m3u8 | go run main.go
After debbugging this for a while I came up with the following fix:
The text was updated successfully, but these errors were encountered: