[Pkg-kde-extras] Bug#680915: kid3: Pipes cause tag corruption

Urs Fleisch urs.fleisch at gmail.com
Sun Aug 26 18:33:34 UTC 2012


> For the Debian maintainers: Please reassign this bug to libid3-3.8.3c2a.
> Unfortunately, id3lib is not actively maintained, but I will try to fix
> the bug there and send a patch for id3lib.

Here is a patch for id3lib, it has to be applied after
debian/patches/30-fix-utf16.patch because it modifies the same file.
It just inserts a BOM before each string of a string list, so that
a valid string list is written.

---
diff -ru id3lib-3.8.3.orig/src/io_helpers.cpp id3lib-3.8.3/src/io_helpers.cpp
--- id3lib-3.8.3.orig/src/io_helpers.cpp	2012-08-26 19:52:21.523825799 +0200
+++ id3lib-3.8.3/src/io_helpers.cpp	2012-08-26 19:53:02.060028394 +0200
@@ -373,10 +373,17 @@
     //}
     // Right code
     unsigned char *pdata = (unsigned char *) data.c_str();
+    unicode_t lastCh = BOM;
     for (size_t i = 0; i < size; i += 2)
     {
       unicode_t ch = (pdata[i] << 8) | pdata[i+1];
+      if (lastCh == 0 && ch != BOM)
+      {
+        // Last character was NULL, so start next string with BOM.
+        writer.writeChars((const unsigned char*) &BOM, 2);
+      }
       writer.writeChars((const unsigned char*) &ch, 2);
+      lastCh = ch;
     }
     // End patch
   }

---

Regards,
Urs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 31-fix-utf16-stringlists.patch
Type: text/x-diff
Size: 757 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-kde-extras/attachments/20120826/69459792/attachment.patch>


More information about the pkg-kde-extras mailing list