rpms/libgpod/F-12 libgpod-handle-partial-utf16.patch, NONE, 1.1 libgpod.spec, 1.29, 1.30
Bastien Nocera
hadess at fedoraproject.org
Thu Dec 10 15:01:07 UTC 2009
Author: hadess
Update of /cvs/pkgs/rpms/libgpod/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25930
Modified Files:
libgpod.spec
Added Files:
libgpod-handle-partial-utf16.patch
Log Message:
* Thu Dec 10 2009 Bastien Nocera <bnocera at redhat.com> 0.7.2-6
- Handle partial UTF-16 strings (#542176)
libgpod-handle-partial-utf16.patch:
itdb_itunesdb.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
--- NEW FILE libgpod-handle-partial-utf16.patch ---
--- libgpod-0.7.2/src/itdb_itunesdb.c 2009-12-10 14:39:04.000000000 +0000
+++ libgpod-0.7.2.new/src/itdb_itunesdb.c 2009-12-10 14:56:22.000000000 +0000
@@ -811,6 +811,22 @@ static inline guint64 get64bint (FConten
}
+/* Try to convert from UTF-16 to UTF-8 and handle partial characters
+ * at the end of the string */
+static char *utf16_to_utf8_with_partial (gunichar2 *entry_utf16)
+{
+ GError *error = NULL;
+ char *entry_utf8;
+ glong items_read;
+
+ entry_utf8 = g_utf16_to_utf8 (entry_utf16, -1, &items_read, NULL, &error);
+ if (entry_utf8 == NULL && g_error_matches (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT)) {
+ g_error_free (error);
+ entry_utf8 = g_utf16_to_utf8 (entry_utf16, items_read, NULL, NULL, NULL);
+ }
+
+ return entry_utf8;
+}
/* Fix little endian UTF16 String to correct byteorder if necessary
@@ -1302,7 +1318,7 @@ static char *extract_mhod_string (FConte
entry_utf16 = g_new0 (gunichar2, (len+2)/2);
if (seek_get_n_bytes (cts, (gchar *)entry_utf16, seek+16, len)) {
fixup_little_utf16 (entry_utf16);
- entry_utf8= g_utf16_to_utf8 (entry_utf16, -1, NULL, NULL, NULL);
+ entry_utf8 = utf16_to_utf8_with_partial (entry_utf16);
g_free (entry_utf16);
} else {
g_free (entry_utf16);
@@ -1317,6 +1333,9 @@ static char *extract_mhod_string (FConte
}
}
+ if (entry_utf8 == NULL)
+ return NULL;
+
if (g_utf8_validate (entry_utf8, -1, NULL)) {
return entry_utf8;
} else {
Index: libgpod.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libgpod/F-12/libgpod.spec,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -p -r1.29 -r1.30
--- libgpod.spec 19 Oct 2009 16:04:27 -0000 1.29
+++ libgpod.spec 10 Dec 2009 15:01:07 -0000 1.30
@@ -3,7 +3,7 @@
Summary: Library to access the contents of an iPod
Name: libgpod
Version: 0.7.2
-Release: 5%{?dist}
+Release: 6%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtkpod.org/libgpod.html
@@ -13,6 +13,8 @@ Patch0: 0001-Use-var-run-hald-as-mount-d
# http://gitorious.org/~teuf/libgpod/teuf-sandbox/commit/3847494a513b5ef04d7abbe55c3d95dbcd836ef6
# https://bugzilla.redhat.com/show_bug.cgi?id=517642
Patch1: libgpod-utf16-parsing.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=542176
+Patch2: libgpod-handle-partial-utf16.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: docbook-style-xsl
BuildRequires: glib2-devel
@@ -82,6 +84,7 @@ libgpod library.
%setup -q
%patch0 -p1 -b .selinux
%patch1 -p1 -b .utf16
+%patch2 -p1 -b .partial-utf16
# remove execute perms on the python examples as they'll be installed in %doc
%{__chmod} -x bindings/python/examples/*.py
@@ -141,6 +144,9 @@ libgpod library.
%changelog
+* Thu Dec 10 2009 Bastien Nocera <bnocera at redhat.com> 0.7.2-6
+- Handle partial UTF-16 strings (#542176)
+
* Mon Oct 19 2009 Bastien Nocera <bnocera at redhat.com> 0.7.2-5
- Fix UTF-16 string parsing patch again
More information about the fedora-extras-commits
mailing list