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 647777 - [PATCH] crash in compute_above_tab_keycode
[PATCH] crash in compute_above_tab_keycode
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2011-04-14 14:13 UTC by Adam Jackson
Modified: 2011-05-25 18:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
trivial fix (810 bytes, patch)
2011-04-14 14:13 UTC, Adam Jackson
needs-work Details | Review
Updated patch (821 bytes, patch)
2011-04-25 17:25 UTC, Adam Jackson
committed Details | Review

Description Adam Jackson 2011-04-14 14:13:59 UTC
Created attachment 185957 [details] [review]
trivial fix

On an F15 system, starting an Xdmx server as follows:

% cat xdmx.conf
virtual default {
    display :0 1280x800 @0x0;
}
% Xdmx -configfile xdmx.conf :1

makes mutter crash:

Program received signal SIGSEGV, Segmentation fault.
compute_above_tab_keycode (xdisplay=0x96c7ab0) at core/above-tab-keycode.c:80
80	  geometry = keyboard->geom;

I'm at something of a loss at the moment to explain why XkbGetKeyboard would return NULL here, but clearly X is not to be trusted.
Comment 1 Dan Winship 2011-04-14 20:28:01 UTC
Comment on attachment 185957 [details] [review]
trivial fix

>+  if (!keyboard)
>+    goto out;

 out:
  XkbFreeKeyboard (keyboard, 0, True);

that seems not good? You could just "return best_keycode;" instead.

> I'm at something of a loss at the moment to explain why XkbGetKeyboard would
> return NULL here

See also the comment above the XkbGetKeyboard call.
Comment 2 Adam Jackson 2011-04-25 17:24:53 UTC
(In reply to comment #1)
> (From update of attachment 185957 [details] [review])
> >+  if (!keyboard)
> >+    goto out;
> 
>  out:
>   XkbFreeKeyboard (keyboard, 0, True);
> 
> that seems not good? You could just "return best_keycode;" instead.

XkbFreeKeyboard(keyboard=NULL) happens to behave like free(NULL) - ie, safely - but yeah, easier to just return.
Comment 3 Adam Jackson 2011-04-25 17:25:57 UTC
Created attachment 186605 [details] [review]
Updated patch