GNOME Bugzilla – Bug 437081
gdk_draw_pixbuf() accepts zero width or height and crashes
Last modified: 2007-05-10 19:23:36 UTC
gdk_draw_pixbuf() does not complain when being called with zero width or height. Also the documentation doesn't mention that this is not allowed. On system where USE_SHM is defined, this also works flawlessly (in other words, nothing is drawn). On the Macintosh however, a different code path is taken and draw_with_images() ends up calling gdk_pixmap_new() with zero width or height. This is caught by a g_val_return_if_fail() and a crash occurs because the NULL return value is used a few lines later. I suggest that gdk_draw_pixbuf() checks width and height and aborts early if they are zero. That should restore the same behaviour on all platforms and all backends without the need to introduce such checks in the lowlevel functions. See bug #349483 for a real-world example of such a crash.
2007-05-10 Matthias Clasen <mclasen@redhat.com> * gdk/gdkdraw.c (gdk_draw_pixbuf): Don't call into the backend if the region is empty. (#437081, Sven Neumann)