Revision: 6878
Author: nogu.dev
Date: Fri Dec 31 16:19:51 2010
Log: * gtk/compose.c
  - (parse_compose_line): Check return value of g_locale_to_utf8().
     If a compose file contains a character which isn't in the current
     locale, g_locale_to_utf8() returns NULL. Note that strdup(NULL)
     segfaults (Debian bug #599837).
http://code.google.com/p/uim/source/detail?r=6878

Modified:
 /trunk/gtk/compose.c

=======================================
--- /trunk/gtk/compose.c        Sun Jun 20 00:04:11 2010
+++ /trunk/gtk/compose.c        Fri Dec 31 16:19:51 2010
@@ -619,10 +619,12 @@
     }

     {
-       char *result;
-       result = g_locale_to_utf8(rhs_string_mb, -1, NULL, NULL, NULL);
-       rhs_string_utf8 = strdup(result);
-       g_free(result);
+        char *result;
+        result = g_locale_to_utf8(rhs_string_mb, -1, NULL, NULL, NULL);
+        if (!result)
+            goto error;
+        rhs_string_utf8 = strdup(result);
+        g_free(result);
     }

     for (i = 0; i < n; i++) {

Reply via email to