mpatric / mp3agic

A java library for reading mp3 files and reading / manipulating the ID3 tags (ID3v1 and ID3v2.2 through ID3v2.4).
MIT License
1.2k stars 310 forks source link

ArrayIndexOutOfBoundsException while creation of the Mp3File #144

Open efulmo opened 6 years ago

efulmo commented 6 years ago

Hi, I am creating an instance of the Mp3File class from the provided file Ghostwriter.mp3 and get the following stacktrace:

Caused by: com.mpatric.mp3agic.InvalidDataException: Premature end of tag
    at com.mpatric.mp3agic.AbstractID3v2Tag.unpackTag(AbstractID3v2Tag.java:143)
    at com.mpatric.mp3agic.AbstractID3v2Tag.<init>(AbstractID3v2Tag.java:126)
    at com.mpatric.mp3agic.ID3v22Tag.<init>(ID3v22Tag.java:17)
    at com.mpatric.mp3agic.ID3v2TagFactory.createID3v22Tag(ID3v2TagFactory.java:22)
    at com.mpatric.mp3agic.ID3v2TagFactory.createTag(ID3v2TagFactory.java:10)
    at com.mpatric.mp3agic.Mp3File.initId3v2Tag(Mp3File.java:297)
    at com.mpatric.mp3agic.Mp3File.init(Mp3File.java:99)
    at com.mpatric.mp3agic.Mp3File.<init>(Mp3File.java:71)
    at com.mpatric.mp3agic.Mp3File.<init>(Mp3File.java:62)
    at com.efulmo.mp3tool.command.RemoveCoverCommand.retainMp3sWithCovers(RemoveCoverCommand.java:109)
    ... 4 more
Caused by: java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at com.mpatric.mp3agic.BufferTools.copyBuffer(BufferTools.java:145)
    at com.mpatric.mp3agic.ID3v2Frame.unpackFrame(ID3v2Frame.java:48)
    at com.mpatric.mp3agic.ID3v2Frame.<init>(ID3v2Frame.java:36)
    at com.mpatric.mp3agic.ID3v2ObseleteFrame.<init>(ID3v2ObseleteFrame.java:11)
    at com.mpatric.mp3agic.AbstractID3v2Tag.createFrame(AbstractID3v2Tag.java:199)
    at com.mpatric.mp3agic.AbstractID3v2Tag.unpackFrames(AbstractID3v2Tag.java:174)
    at com.mpatric.mp3agic.AbstractID3v2Tag.unpackTag(AbstractID3v2Tag.java:138)
    ... 13 more

The file itself is not broken. It is opened and played with no issues in the media player. I think it is a bug in a code of the library. Could you check it? The version of the mp3agic is 0.9.1.