[patch] fix zero length ID3v2 frames

Scott Wheeler wheeler at kde.org
Sun Sep 4 22:55:44 CEST 2005

On Wednesday 31 August 2005 12:27, Andrew de Quincey wrote:
> Hi, I had a couple of mp3 files that taglib just ignored the ID3 contents
> of. Turns out they have several 0 length frames in them.
> The attached patch makes taglib ignore any zero length frames completely,
> while still parsing other frames correctly. I thought this would be more
> fault tolerant than just attempting to parse them as normal frames - e.g.
> in case we find a 0 length text frame, which would be quite invalid (no
> text encoding information).

I'm not quite sure on this one -- the frames will definitely need to be 
discarded since per the ID3v2 spec frames are required to contain at least 
one byte of information.

The remaining question is what to do when broken frames are encountered.  I'll 
probably apply some version of this, but there's still a case that worries 

There's no offset table for frames in ID3v2, so you have to iterate through 
them when parsing.  When frames have invalid values they're often just wrong 
-- i.e. it might say "0" and then actual content follows.  That throws off 
the rest of the parsing and can cause some strange errors...


The fact that an opinion has been widely held is no evidence whatever that it 
is not utterly absurd. 
--Bertrand Russell

More information about the taglib-devel mailing list