Package: libtag1c2a
Version: 1.4-4
Severity: important
Tags: patch

I have many mp3 files which have id3v2 tags with zero-sized frames in
them; that is, the 4 byte frame identfier, 4 nulls, and 2 flag bytes.
This isn't an issue with other tag processing apps/libs, but taglib
fails to parse the tag after such a frame. So only the data to the first
such frame is processed, which leads to an incomplete display of file
information in the various players using taglib.
The attached patch fixes the issue.

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-ck1
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages libtag1c2a depends on:
hi  libc6                         2.3.6-7    GNU C Library: Shared libraries
hi  libgcc1                       1:4.1.1-21 GCC support library
hi  libstdc++6                    4.1.1-21   The GNU Standard C++ Library v3
hi  zlib1g                        1:1.2.3-11 compression library - runtime

libtag1c2a recommends no packages.

-- no debconf information
diff -ruN taglib-1.4/taglib/mpeg/id3v2/frames/textidentificationframe.cpp taglib-1.4-mine/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
--- taglib-1.4/taglib/mpeg/id3v2/frames/textidentificationframe.cpp	2005-05-17 22:17:26.000000000 +0200
+++ taglib-1.4-mine/taglib/mpeg/id3v2/frames/textidentificationframe.cpp	2007-03-05 04:27:39.265744795 +0100
@@ -94,6 +94,10 @@
 
 void TextIdentificationFrame::parseFields(const ByteVector &data)
 {
+  if(data.size() == 0) {
+    return;
+  }
+
   // read the string data type (the first byte of the field data)
 
   d->textEncoding = String::Type(data[0]);
diff -ruN taglib-1.4/taglib/mpeg/id3v2/id3v2framefactory.cpp taglib-1.4-mine/taglib/mpeg/id3v2/id3v2framefactory.cpp
--- taglib-1.4/taglib/mpeg/id3v2/id3v2framefactory.cpp	2005-07-25 23:10:42.000000000 +0200
+++ taglib-1.4-mine/taglib/mpeg/id3v2/id3v2framefactory.cpp	2007-03-05 03:58:00.714125739 +0100
@@ -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;
   }
diff -ruN taglib-1.4/taglib/mpeg/id3v2/id3v2tag.cpp taglib-1.4-mine/taglib/mpeg/id3v2/id3v2tag.cpp
--- taglib-1.4/taglib/mpeg/id3v2/id3v2tag.cpp	2005-07-25 23:10:42.000000000 +0200
+++ taglib-1.4-mine/taglib/mpeg/id3v2/id3v2tag.cpp	2007-03-05 03:57:12.625436331 +0100
@@ -438,7 +438,7 @@
 
     // Checks to make sure that frame parsed correctly.
 
-    if(frame->size() <= 0) {
+    if(frame->size() < 0) {
       delete frame;
       return;
     }

Reply via email to