Package: gok
Version: 1.0.10-1
Severity: important
Tags: patch

While investigating #369864, I found that gok doesn't start if it
has problems reading the database. Note that this is not the same as
#369864.

The problems are freeing of an uninitialized pointer and a div-by-0.
A patch is attached.

The problem can be reproduced by setting up a fresh sid chroot,
installing gok, and probably xbase-clients, starting gok and
watching it segfault (given that it finds a proper display, which
can be ensured by bindmounting /tmp to /chroots/sid/tmp).

Cheers,
Christian Aichinger

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'testing-proposed-updates'), (500, 
'proposed-updates'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-rc6-vs2.1.0-pre1-r20050817
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)
--- gok-1.0.10.old/gok/gok-data.c       2006-03-31 22:32:58.000000000 +0200
+++ gok-1.0.10/gok/gok-data.c   2006-06-07 12:26:37.000000000 +0200
@@ -240,15 +240,17 @@
         gok_gconf_get_string (gconf_client, GOK_GCONF_AUX_DICTS, 
                                 &m_AuxDicts);
 
-       gok_gconf_get_string (gconf_client, GOK_GCONF_DOCK_TYPE,
-                             &a_gchar);
-        m_eDockType = gok_data_dock_type_from_string (a_gchar);
-       g_free (a_gchar);
-
-       gok_gconf_get_string (gconf_client, GOK_GCONF_COMPOSE_KBD_TYPE,
-                             &a_gchar);
-        compose_keyboard_type = gok_data_compose_type_from_string (a_gchar);
-       g_free (a_gchar);
+       if (gok_gconf_get_string (gconf_client, GOK_GCONF_DOCK_TYPE,
+                             &a_gchar)) {
+            m_eDockType = gok_data_dock_type_from_string (a_gchar);
+            g_free (a_gchar);
+        }
+
+       if (gok_gconf_get_string (gconf_client, GOK_GCONF_COMPOSE_KBD_TYPE,
+                             &a_gchar)) {
+            compose_keyboard_type = gok_data_compose_type_from_string 
(a_gchar);
+            g_free (a_gchar);
+        }
 
        /* Read in settings for individual access methods */
        access_method_dirs
--- gok-1.0.10.old/gok/gok-keyboard.c   2006-05-15 17:10:00.000000000 +0200
+++ gok-1.0.10/gok/gok-keyboard.c       2006-06-07 12:38:08.000000000 +0200
@@ -3322,6 +3322,8 @@
                /* maximum size of text per cell */
                maxTextPerCell = gok_data_get_key_width() - 
                        gok_key_get_default_border_width (pKey);
+                if (!maxTextPerCell)
+                    maxTextPerCell = 1;
        }
 
        while (pKey != NULL)

Attachment: signature.asc
Description: Digital signature

Reply via email to