This appears to be a bug in glibc. From glib/gmem.h

The program crashes on this line:

 view_text->priv = g_new0 (glViewTextPrivate, 1);

And gdb reports

(gdb) p sizeof(glViewTextPrivate)
$1 = 0

expanding g_new0 reveals

#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
#  define _G_NEW(struct_type, n_structs, func) \
        (struct_type *) (__extension__ ({                       \
          gsize __n = (gsize) (n_structs);                      \
          gsize __s = sizeof (struct_type);                     \
          gpointer __p;                                         \
          if (__s == 1)                 \
            __p = g_##func (__n);                               \
          else if (__builtin_constant_p (__n) &&                \
                   __n <= G_MAXSIZE / __s)                      \
            __p = g_##func (__n * __s);                         \
          else                                                  \
            __p = g_##func##_n (__n, __s);                      \
          __p;                                                  \
        }))

which crashes due to a divide by zero in G_MAXSIZE/__s since __s =
sizeof(glViewTextPrivate) = 0.

glViewTextPrivate is defined in view-text.c line 48. As a workaround, I
simply added a dummy int to the (obviously empty struct):

struct _glViewTextPrivate {
  int dummy;    
};

and again in view-image.c

struct _glViewImagePrivate {
  int dummy;
};

this seems to work. Attaching new diff.gz file.

** Patch added: "diff including my 2 changes"
   http://launchpadlibrarian.net/43144016/glabels_2.2.7-2.diff.gz

-- 
glabels crashed with SIGFPE in g_type_create_instance()
https://bugs.launchpad.net/bugs/551958
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to