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 700465 - Missing NULL-check in XI2's implementation for get_window()
Missing NULL-check in XI2's implementation for get_window()
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
3.9.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-05-16 14:32 UTC by Mario Sánchez Prada
Modified: 2013-05-20 01:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch proposal (1.06 KB, patch)
2013-05-16 14:37 UTC, Mario Sánchez Prada
accepted-commit_now Details | Review

Description Mario Sánchez Prada 2013-05-16 14:32:41 UTC
While working with an cross-compiled version of GTK+3 for an embedded device, I found a crash whenever I tried to paint a GtkWindow bigger than certain values, which lead me to find, using gdb, a missing nullcheck in gdkdevicemanager-xi2.c.

I checked carefully the backtrace and the flow that ends up segfaulting in XI2's get_window() (due to a NULL XIEvent in xevent->xcookie.data) starts in _gdk_x11_display_queue_events(), inside gdkeventsource.c, where the code is clearly prepared to deal with NULL values returned from  gdk_event_source_translate_event().

So, I believe the issue might be fixed by simply adding the missing NULL-check in gdk_x11_device_manager_xi2_get_window(). At least, that worked wonderfully well for me so far.
Comment 1 Mario Sánchez Prada 2013-05-16 14:37:59 UTC
Created attachment 244416 [details] [review]
Patch proposal

Attaching the patch that fixes the issue
Comment 2 Matthias Clasen 2013-05-17 02:51:02 UTC
Review of attachment 244416 [details] [review]:

Makes sense