--Boundary-00=_DYYFDJzw1kbKSFv Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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). The 0length frames in the files in question were: WOAF WOAR WOAS --Boundary-00=_DYYFDJzw1kbKSFv Content-Type: text/x-diff; charset="us-ascii"; name="taglib-ignore0length.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="taglib-ignore0length.patch" Index: mpeg/id3v2/id3v2tag.cpp =================================================================== --- mpeg/id3v2/id3v2tag.cpp (revision 455351) +++ mpeg/id3v2/id3v2tag.cpp (working copy) @@ -438,13 +438,17 @@ // Checks to make sure that frame parsed correctly. - if(frame->size() <= 0) { + if(frame->size() < 0) { delete frame; return; } frameDataPosition += frame->size() + Frame::headerSize(d->header.majorVersion()); - addFrame(frame); + if (frame->size() == 0) { + delete frame; + } else { + addFrame(frame); + } } } Index: mpeg/id3v2/id3v2framefactory.cpp =================================================================== --- mpeg/id3v2/id3v2framefactory.cpp (revision 455351) +++ mpeg/id3v2/id3v2framefactory.cpp (working copy) @@ -72,7 +72,7 @@ // A quick sanity check -- make sure that the frameID is 4 uppercase Latin1 // characters. Also make sure that there is data in the frame. - if(!frameID.size() == (version < 3 ? 3 : 4) || header->frameSize() <= 0) { + if(!frameID.size() == (version < 3 ? 3 : 4) || header->frameSize() < 0) { delete header; return 0; } @@ -103,6 +103,10 @@ return new UnknownFrame(data, header); } + if (header->frameSize() == 0) { + return new UnknownFrame(data, header); + } + // updateFrame() might have updated the frame ID. frameID = header->frameID(); --Boundary-00=_DYYFDJzw1kbKSFv Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline _______________________________________________ taglib-devel mailing list taglib-devel@kde.org https://mail.kde.org/mailman/listinfo/taglib-devel --Boundary-00=_DYYFDJzw1kbKSFv--