After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 437081 - gdk_draw_pixbuf() accepts zero width or height and crashes
gdk_draw_pixbuf() accepts zero width or height and crashes
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.10.x
Other Mac OS
: Normal major
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-05-09 07:05 UTC by Sven Neumann
Modified: 2007-05-10 19:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sven Neumann 2007-05-09 07:05:08 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.
Comment 1 Matthias Clasen 2007-05-10 19:23:36 UTC
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)