Ticket #133 (closed Bug: Fixed)

Opened 5 years ago

Last modified 5 years ago

Errors in id3 handling, skips into next frame

Reported by: matthewsewell Owned by: joachim
Priority: Major Component: App Server
Version: 0.8 RC2 Keywords:
Cc:

Description

We found that in processID3v2Header method of org.red5.io.mp3.impl.MP3Reader there is some missing error checking. If the size bits in the header are incorrectly set by the encoder such that they do not fit the 0xxxxxxx pattern, the method will try to skip backwards in the file rather than forward, we addressed this by simply anding out the high bit with & 0x07F.

Also, in the same method there is an error in the way it skips past the IDsv2 tag. It skips forward by the size of the tag, but doesn't to take into account that it is already 10 bytes into the tag (the size of the header). If the first synch bits immediately follow the id3v2 tag, data within the first frame can be seen as the synch bits, throwing off every frame. This is fixed by just subtracting 10 from the offset used to skip.

We are attaching 2 patches that should be applied in order.

Attachments

MP3Reader.java.2.patch Download (280 bytes) - added by matthewsewell 3 years ago.
MP3Reader.java.2.patch2 Download (61 bytes) - added by matthewsewell 3 years ago.

Change History

Changed 5 years ago by matthewsewell

Apply this 1st.

Changed 5 years ago by matthewsewell

Apply this 2nd.

Changed 5 years ago by joachim

Incorrect handling of signed bytes in the size is fixed in r1765.

The second patch was not applied as the size is stored as "TagSize - 10" as described in the ID3v2 spec ( http://www.id3.org/id3v2.4.0-structure), so that is handled correctly.
I tested with one of my files that contain an ID3v2 header and the position seeked to is correct.

Changed 3 years ago by matthewsewell

Changed 3 years ago by matthewsewell

Note: See TracTickets for help on using tickets.