[gst-cvs] gst-plugins-bad: id3mux: glib doesn' t reliably null-terminate wide-character encodings in

Michael Smith msmith at kemper.freedesktop.org
Tue Oct 27 14:32:15 PDT 2009


Module: gst-plugins-bad
Branch: master
Commit: 29fe6205ca9f756a8838994461fb018639457da8
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=29fe6205ca9f756a8838994461fb018639457da8

Author: Michael Smith <msmith at songbirdnest.com>
Date:   Tue Oct 27 14:31:39 2009 -0700

id3mux: glib doesn't reliably null-terminate wide-character encodings in
g_convert, so write the null-terminator separately and explicitly.

---

 gst/id3tag/id3tag.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gst/id3tag/id3tag.c b/gst/id3tag/id3tag.c
index 0763334..899bd4b 100644
--- a/gst/id3tag/id3tag.c
+++ b/gst/id3tag/id3tag.c
@@ -374,10 +374,11 @@ id3v2_frame_write_string (GstId3v2Frame * frame, int encoding,
 
     /* Write the BOM */
     id3v2_frame_write_bytes (frame, (const guint8 *) bom, 2);
-    /* NUL terminator is 2 bytes, if present */
-    terminator_length = null_terminate ? 2 : 0;
-    id3v2_frame_write_bytes (frame, (const guint8 *) utf16,
-        utf16len + terminator_length);
+    id3v2_frame_write_bytes (frame, (const guint8 *) utf16, utf16len);
+    if (null_terminate) {
+      /* NUL terminator is 2 bytes, if present. */
+      id3v2_frame_write_uint16 (frame, 0);
+    }
 
     g_free (utf16);
   } else {





More information about the Gstreamer-commits mailing list