Be a little less strict on invalid frames

Add iTunes frames and ignore unknown frame only if they are too big
This commit is contained in:
Xavier Henner
2015-07-12 02:02:12 +02:00
parent 334c71001c
commit 05c9a3fa59
2 changed files with 11 additions and 5 deletions
+5 -5
View File
@@ -219,11 +219,6 @@ func readID3v2Frames(r io.Reader, h *id3v2Header) (map[string]interface{}, error
return nil, err
}
// Avoid corrupted padding (see http://id3.org/Compliance%20Issues).
if !validID3Frame(h.Version, name) {
break
}
// FIXME: Do we still need this?
// if size=0, we certainly are in a padding zone. ignore the rest of
// the tags
@@ -233,6 +228,11 @@ func readID3v2Frames(r io.Reader, h *id3v2Header) (map[string]interface{}, error
offset += headerSize + size
// Avoid corrupted padding (see http://id3.org/Compliance%20Issues).
if !validID3Frame(h.Version, name) && offset > h.Size {
break
}
if flags != nil {
if flags.Compression {
_, err = read7BitChunkedInt(r, 4) // read 4