From 22a67155365b6310bf9227216b024b377b4d1ec5 Mon Sep 17 00:00:00 2001 From: Anders Pearson Date: Sun, 22 Oct 2017 11:42:29 +0100 Subject: [PATCH] fix bug with invalid APIC mimetype Return an error if the mimetype can't be decoded rather than panicking. See #28. --- id3v2frames.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/id3v2frames.go b/id3v2frames.go index 16083a7..6b842c3 100644 --- a/id3v2frames.go +++ b/id3v2frames.go @@ -597,6 +597,9 @@ func readAPICFrame(b []byte) (*Picture, error) { mimeType := string(mimeDataSplit[0]) b = mimeDataSplit[1] + if len(b) < 1 { + return nil, fmt.Errorf("error decoding APIC mimetype") + } picType := b[0] descDataSplit, err := dataSplit(b[1:], enc)