From 68dda183d12a050607227b856fb59a6c44ffaeaf Mon Sep 17 00:00:00 2001 From: Xavier Henner Date: Wed, 20 May 2015 11:52:09 +0200 Subject: [PATCH] skip invalid frame --- mp3.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mp3.go b/mp3.go index 2746aa5..e2a9dff 100644 --- a/mp3.go +++ b/mp3.go @@ -95,6 +95,10 @@ func getMp3Infos(r io.ReadSeeker, slow bool) (*mp3Infos, error) { if i < 4 { break } + if i==5 { + // invalid frame + continue + } pos += int64(i) // looking for the synchronization bits switch { @@ -108,10 +112,8 @@ func getMp3Infos(r io.ReadSeeker, slow bool) (*mp3Infos, error) { if h.vbr > 2 { nbscan = 100 } - break case string(buf[:3]) == "TAG": pos, _ = r.Seek(128-4, 1) // id3v1 tag, bypass it - break default: r.Seek(-3, 1) // looking for the next header }