taglib-1.5: corrupted PNG-header while parsing APIC-frame

Maxim Bourmistrov maxim.bourmistrov at unixconn.com
Thu Oct 30 08:58:15 CET 2008


Hello,
taglib-1.5 stores a corrupted image-data while parsing APIC-frame with  
PNG-image inside.

Here is a quick, working fix to attachedpictureframe.cpp:

void AttachedPictureFrame::parseFields(const ByteVector &data)
{
   if(data.size() < 5) {
     debug("A picture frame must contain at least 5 bytes.");
     return;
   }

   d->textEncoding = String::Type(data[0]);

   int img_start, pos = 1;

   d->mimeType = readStringField(data, String::Latin1, &pos);
   d->type = (TagLib::ID3v2::AttachedPictureFrame::Type)data[pos++];

   img_start = pos;
   d->description = readStringField(data, d->textEncoding, &pos);

   d->data = data.mid(img_start);
}


Tested with PNG-image inside APIC-frame.
Here is a detailed description with some nice screenshots :) -> http://en.roolz.org/Blog/Entries/2008/10/29_Using_taglib_to_extract_cover_image_from_MP3-files.html

I'm not on this list, so please replay to my mail directly.

//maxim


More information about the taglib-devel mailing list