summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-09-17 03:23:32 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-09-17 03:23:32 +0000
commit5717212948d2ca0e0b1296554c69b73bc8b9da15 (patch)
treef8a0d6ce47fbb3527bff02eaf3a60cf3c1cc91e6
parentec6f32e14a5b144a84307832e41993e7cb08fea7 (diff)
downloadgdk-pixbuf-5717212948d2ca0e0b1296554c69b73bc8b9da15.tar.gz
Warn if a UTF8_STRING or text/plain;charset=utf-8 roperty contains invalid
Thu Sep 16 23:20:05 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkselection.c (selection_get_text_plain): * gdk/x11/gdkselection-x11.c (make_list): Warn if a UTF8_STRING or text/plain;charset=utf-8 roperty contains invalid UTF-8. (#152845, Owen Taylor)
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--ChangeLog.pre-2-67
-rw-r--r--ChangeLog.pre-2-87
-rw-r--r--gdk/x11/gdkselection-x11.c10
-rw-r--r--gtk/gtkselection.c21
6 files changed, 50 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 18175473e..fbb87839f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Sep 16 23:20:05 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkselection.c (selection_get_text_plain):
+ * gdk/x11/gdkselection-x11.c (make_list): Warn if a UTF8_STRING
+ or text/plain;charset=utf-8 roperty contains invalid
+ UTF-8. (#152845, Owen Taylor)
+
2004-09-16 Matthias Clasen <mclasen@redhat.com>
Fix #152760, Christian Persch:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 18175473e..fbb87839f 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,10 @@
+Thu Sep 16 23:20:05 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkselection.c (selection_get_text_plain):
+ * gdk/x11/gdkselection-x11.c (make_list): Warn if a UTF8_STRING
+ or text/plain;charset=utf-8 roperty contains invalid
+ UTF-8. (#152845, Owen Taylor)
+
2004-09-16 Matthias Clasen <mclasen@redhat.com>
Fix #152760, Christian Persch:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 18175473e..fbb87839f 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,10 @@
+Thu Sep 16 23:20:05 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkselection.c (selection_get_text_plain):
+ * gdk/x11/gdkselection-x11.c (make_list): Warn if a UTF8_STRING
+ or text/plain;charset=utf-8 roperty contains invalid
+ UTF-8. (#152845, Owen Taylor)
+
2004-09-16 Matthias Clasen <mclasen@redhat.com>
Fix #152760, Christian Persch:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 18175473e..fbb87839f 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,10 @@
+Thu Sep 16 23:20:05 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkselection.c (selection_get_text_plain):
+ * gdk/x11/gdkselection-x11.c (make_list): Warn if a UTF8_STRING
+ or text/plain;charset=utf-8 roperty contains invalid
+ UTF-8. (#152845, Owen Taylor)
+
2004-09-16 Matthias Clasen <mclasen@redhat.com>
Fix #152760, Christian Persch:
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c
index ef079dee2..13aca15ce 100644
--- a/gdk/x11/gdkselection-x11.c
+++ b/gdk/x11/gdkselection-x11.c
@@ -516,7 +516,15 @@ make_list (const gchar *text,
}
}
else
- str = g_strndup (p, q - p);
+ {
+ str = g_strndup (p, q - p);
+ if (!g_utf8_validate (str, -1, NULL))
+ {
+ g_warning ("Error converting selection from UTF8_STRING");
+ g_free (str);
+ str = NULL;
+ }
+ }
if (str)
{
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index d0ec8b8bc..e9fab8601 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -1032,20 +1032,25 @@ selection_get_text_plain (GtkSelectionData *selection_data)
charset, "UTF-8",
NULL, NULL, &len, &error);
g_free (tmp);
- }
- if (!str)
+ if (!str)
+ {
+ g_warning ("Error converting from %s to UTF-8: %s",
+ charset, error->message);
+ g_error_free (error);
+
+ return NULL;
+ }
+ }
+ else if (!g_utf8_validate (str, -1, NULL))
{
- g_warning ("Error converting from %s to UTF-8: %s",
- charset, error->message);
- g_error_free (error);
-
+ g_warning ("Error converting from text/plain;charset=utf-8 to UTF-8");
+ g_free (str);
+
return NULL;
}
-
result = normalize_to_lf (str, len);
-
g_free (str);
return result;