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

List:       taglib-devel
Subject:    Re: [PATCH] Sanitize ID3v2.3 frames
From:       "Xavier Duret" <xaviour.maillists () gmail ! com>
Date:       2007-01-19 10:21:03
Message-ID: d3ef58310701190221n75093f9wccc427036ba9a4ad () mail ! gmail ! com
[Download RAW message or body]

Valgrind revealed a memory leak with this patch. Here is an update.

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-18
20:35:46.000000000 +0100
+++ taglib/taglib/mpeg/id3v2/id3v2tag.cpp       2007-01-18
20:37:04.000000000 +0100
@@ -437,7 +437,10 @@
     }

     frameDataPosition += frame->size() +
Frame::headerSize(d->header.majorVersion());
-    addFrame(frame);
+    if (!(frame->frameID() == "JUNK"))
+      addFrame(frame);
+    else
+      delete frame;
   }
 }

On 1/17/07, Xavier Duret <xaviour.maillists@gmail.com> wrote:
> 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.
_______________________________________________
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