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 735389 - client crashes if it gets an invalid keymap from the compositor
client crashes if it gets an invalid keymap from the compositor
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other Mac OS
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-08-25 14:38 UTC by Carlos Garnacho
Modified: 2014-08-26 11:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland: Protect against invalid keymaps gotten from the compositor (1.91 KB, patch)
2014-08-25 14:38 UTC, Carlos Garnacho
committed Details | Review
keymap string (44.96 KB, text/plain)
2014-08-25 19:45 UTC, Carlos Garnacho
  Details
stderr during on xkb_keymap_new_from_string() (5.81 KB, text/plain)
2014-08-25 19:47 UTC, Carlos Garnacho
  Details

Description Carlos Garnacho 2014-08-25 14:38:15 UTC
If the client is given a keymap string which produces compile errors, xkb_keymap_new_from_string() returns NULL and the xkb_state creation crashes when given a NULL keymap.

I'm attaching a patch that, in these situations, issue a warning and keep the previous keymap/state around, since having instances of those is indispensable for keyboard events, even if not fully correct.
Comment 1 Carlos Garnacho 2014-08-25 14:38:44 UTC
Created attachment 284408 [details] [review]
wayland: Protect against invalid keymaps gotten from the compositor

If the compositor sends a keymap that fails on "compilation",
xkb_keymap_new_from_string() returns NULL, which makes xkb_state_new()
crash when assuming there is a keymap.

In these cases, gdk must remain with a xkb_state to handle modifiers/keys
properly, so warn about the invalid keymap string, and keep the previous
keymap (currently initialized to "us")
Comment 2 Matthias Clasen 2014-08-25 15:40:57 UTC
Do you have an example for a keymap string that fails during complication ?
Comment 3 Carlos Garnacho 2014-08-25 19:45:12 UTC
Created attachment 284446 [details]
keymap string

Might be something in my setup... I just have xkbcomp on /usr/bin, not sure if there's been changes around. I also only see this running mutter --wayland nested. this anyway deserves further investigation.
Comment 4 Carlos Garnacho 2014-08-25 19:47:47 UTC
Created attachment 284447 [details]
stderr during on xkb_keymap_new_from_string()
Comment 5 Matthias Clasen 2014-08-25 22:32:12 UTC
Review of attachment 284408 [details] [review]:

looks ok as a defensive measure
Comment 6 Carlos Garnacho 2014-08-26 11:05:11 UTC
Attachment 284408 [details] pushed as 8f2d8df - wayland: Protect against invalid keymaps gotten from the compositor