[patch] fix zero length ID3v2 frames
Andrew de Quincey
adq_dvb at lidskialf.net
Sun Sep 4 23:10:46 CEST 2005
On Sunday 04 Sep 2005 21:55, Scott Wheeler wrote:
> 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.
Cool!
> 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 me:
>
> 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...
Hmm yeah, bit of a nasty one.... you'd get an unknown frame ID yeah? I suppose
you could do something involving seeking into the unknown frame's data and
checking it against the known list of valid frame IDs... as you already know
the total size of the tag data, it should be possible to make it bulletproof.
More information about the taglib-devel
mailing list