panic: runtime error: slice bounds out of range [:3] with capacity 1
deluan opened this issue · comments
Deluan Quintão commented
Found the above panic when reading tags from the following file: 03.-.Semblance.Of.Confusion.-.defect.zip
When using the tag
command line. tool, I get this stack trace:
$ tag ~/Downloads/03\ -\ Semblance\ Of\ Confusion\ -\ defect.mp3
panic: runtime error: slice bounds out of range [:3] with capacity 1
goroutine 1 [running]:
github.com/dhowden/tag.readTextWithDescrFrame(0xc00008c0c8, 0x2, 0x2, 0x101, 0x1277b20, 0x0, 0x0)
/Users/deluan/Development/go/src/github.com/dhowden/tag/id3v2frames.go:460 +0x46b
github.com/dhowden/tag.readID3v2Frames(0x1795008, 0xc00000e030, 0x4e, 0xc00008e000, 0xc00000e030, 0x0, 0x0)
/Users/deluan/Development/go/src/github.com/dhowden/tag/id3v2.go:364 +0x8b7
github.com/dhowden/tag.ReadID3v2Tags(0x1173320, 0xc00000e030, 0x1, 0x0, 0x0, 0x0)
/Users/deluan/Development/go/src/github.com/dhowden/tag/id3v2.go:428 +0xde
github.com/dhowden/tag.ReadFrom(0x1173320, 0xc00000e030, 0x0, 0x0, 0xc00000e030, 0x0)
/Users/deluan/Development/go/src/github.com/dhowden/tag/tag.go:52 +0x324
main.main()
/Users/deluan/Development/go/src/github.com/dhowden/tag/cmd/tag/main.go:46 +0x1be
Tried with other tag extractors (TagLib and ffmpeg) and they are both able to extract the tags. Ex. with tagreader
from TagLib:
$ tagreader ~/Downloads/03\ -\ Semblance\ Of\ Confusion\ -\ defect.mp3
******************** "/Users/deluan/Downloads/03 - Semblance Of Confusion - defect.mp3" ********************
-- TAG (basic) --
title - "Semblance Of Confusion"
artist - "After Forever"
album - "Prison of Desire"
year - "2000"
comment - ""
track - "3"
genre - "Metal"
-- TAG (properties) --
ALBUM - "Prison of Desire"
ARTIST - "After Forever"
COMMENT - ""
DATE - "2000"
GENRE - "Metal"
MEDIA - "DIG"
TITLE - "Semblance Of Confusion"
TRACKNUMBER - "03"
URL - ""
-- AUDIO --
bitrate - 128
sample rate - 44100
channels - 2
length - 4:90
Thanks!
David Howden commented
Added a change to return an error instead of triggering a panic here.
In my quick read of the spec [1] I couldn't find how to get around this without erroring, but I only did a very quick scan through! However, feel free to open another ticket with spec references if this should be updated.
[1] https://id3.org/