Bug#908439: gtk+3.0: FTBFS with gdk-pixbuf 2.38: /Default Values/GdkPixbuf: g_bytes_new: assertion 'data != NULL || size == 0' failed

Simon McVittie smcv at debian.org
Mon Sep 10 01:04:35 BST 2018


Control: clone -1 -2
Control: severity -2 normal
Control: retitle -2 Assertion failure accessing pixel-bytes of default-constructed GdkPixbuf: data != NULL || size == 0
Control: forwarded -2 https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/91
Control: reassign -2 libgdk-pixbuf2.0-0 2.38.0+dfsg-4

I'm using #908439 for the gtk+3.0 FTBFS and the new clone for the
gdk-pixbuf bug.

On Mon, 10 Sep 2018 at 00:31:13 +0100, Simon McVittie wrote:
> (/srv/tmp/smcv/build-area/gtk+3.0-3.24.0/debian/build/deb/testsuite/gtk/.libs/defaultvalue:8467): GLib-CRITICAL **: 00:19:27.089: g_bytes_new: assertion 'data != NULL || size == 0' failed

#4  0x00007ffff6ce4450 in gdk_pixbuf_get_property (object=0x555555784b00, prop_id=9, value=0x7fffffffdad0, pspec=0x55555582ad40) at ../gdk-pixbuf/gdk-pixbuf.c:1345

Line 1345 is:

          case PROP_PIXEL_BYTES:
                  g_value_set_boxed (value, gdk_pixbuf_read_pixel_bytes (pixbuf));

In the mode where the GdkPixbuf is backed by mutable pixels and not an
immutable GBytes structure, this returns:

                return g_bytes_new (pixbuf->s.pixels.pixels,
                                    gdk_pixbuf_get_byte_length (pixbuf));

where gdk_pixbuf_get_byte_length() returns:

       return ((pixbuf->height - 1) * pixbuf->rowstride +
                pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));

(gdb) p *(GdkPixbuf *)object
$1 = {parent_instance = {g_type_instance = {Python Exception <class 'gdb.error'> No type named TypeNode.:
g_class = }, ref_count = 2, qdata = 0x0},
  colorspace = GDK_COLORSPACE_RGB, n_channels = 3, bits_per_sample = 8, width = 1, height = 1, rowstride = 1,
  storage = STORAGE_PIXELS, s = {pixels = {pixels = 0x0, destroy_fn = 0x0, destroy_fn_data = 0x0}, bytes = {
      bytes = 0x0}}, has_alpha = 0}

So the calculation is that this 1x1 GdkPixbuf should have 3 bytes of
data, namely the R,G,B values of its single pixel.

You can reproduce this quicker in Python:

>>> from gi.repository import GdkPixbuf
>>> GdkPixbuf.Pixbuf().props.pixel_bytes
__main__:1: Warning: g_bytes_new: assertion 'data != NULL || size == 0' failed

Before 2.38 it would have returned NULL whenever not backed by a GBytes,
even if there was a non-NULL pixel data blob (which also seems like
a bug).

I think this is really a gdk-pixbuf bug, but we can work around it by not
testing the GdkPixbuf type in this way.

    smcv



More information about the pkg-gnome-maintainers mailing list