[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglib-devel
Subject:    [PATCH] Sanitize ID3v2.3 frames
From:       "Xavier Duret" <xaviour.maillists () gmail ! com>
Date:       2007-01-17 20:31:43
Message-ID: d3ef58310701171231q3c1cd1fdl56343c58c925cd73 () mail ! gmail ! com
[Download RAW message or body]

This patch filters out empty ID3v2.3 frames that cause taglib to
report the genre as blues. This patch has to be applied after the
"repeated genre" fix.

diff -ruN taglib.old/taglib/mpeg/id3v2/id3v2frame.cpp
taglib/taglib/mpeg/id3v2/id3v2frame.cpp
--- taglib.old/taglib/mpeg/id3v2/id3v2frame.cpp 2007-01-17
16:01:33.000000000 +0100
+++ taglib/taglib/mpeg/id3v2/id3v2frame.cpp     2007-01-17
21:09:08.000000000 +0100
@@ -326,6 +326,11 @@
     // the frame header (structure 4)

     d->frameSize = data.mid(4, 4).toUInt();
+    if ((d->frameSize == 0) ||
+        ((d->frameSize == 1) && (data.mid(10, 1) ==
textDelimiter(String::Latin1)))) {
+      d->frameID = ByteVector("JUNK",4);
+      return;
+    }

     { // read the first byte of flags
       std::bitset<8> flags(data[8]);
diff -ruN taglib.old/taglib/mpeg/id3v2/id3v2tag.cpp
taglib/taglib/mpeg/id3v2/id3v2tag.cpp
--- taglib.old/taglib/mpeg/id3v2/id3v2tag.cpp    2007-01-17
21:12:29.000000000 +0100
+++ taglib/taglib/mpeg/id3v2/id3v2tag.cpp        2007-01-17
21:01:00.000000000 +0100
@@ -437,7 +437,9 @@
     }

     frameDataPosition += frame->size() +
Frame::headerSize(d->header.majorVersion());
-    addFrame(frame);
+
+    if (!(frame->frameID() == "JUNK"))
+      addFrame(frame);
   }
 }
_______________________________________________
taglib-devel mailing list
taglib-devel@kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic