|
Parag Nemade |
a2e1dc |
From 5535de3543fdbf8f82931e5346dacc1ecc77b3a8 Mon Sep 17 00:00:00 2001
|
|
Parag Nemade |
a2e1dc |
From: Rui Matos <tiagomatos@gmail.com>
|
|
Parag Nemade |
a2e1dc |
Date: Wed, 7 Oct 2015 17:53:03 +0200
|
|
Parag Nemade |
a2e1dc |
Subject: [PATCH] xadapter: Avoid a crash when Xkl doesn't know the real xkb
|
|
Parag Nemade |
a2e1dc |
groups
|
|
Parag Nemade |
a2e1dc |
|
|
Parag Nemade |
a2e1dc |
Xkl.ConfigRec gets its layouts and variants from the _XKB_RULES_NAMES
|
|
Parag Nemade |
a2e1dc |
root window property which isn't specified anywhere and in fact
|
|
Parag Nemade |
a2e1dc |
doesn't get set under Xwayland. The group index though is accurate
|
|
Parag Nemade |
a2e1dc |
which means that we might end up trying to access an invalid index on
|
|
Parag Nemade |
a2e1dc |
the layouts or variants array and crashing.
|
|
Parag Nemade |
a2e1dc |
|
|
Parag Nemade |
a2e1dc |
Avoid this by just lying to the caller since we can't obtain the real
|
|
Parag Nemade |
a2e1dc |
layout/variant names in that case. Since this only happens under
|
|
Parag Nemade |
a2e1dc |
Xwayland and in that case the only consumer of this API is gnome-shell
|
|
Parag Nemade |
a2e1dc |
which ends up not using the names, this should be safe.
|
|
Parag Nemade |
a2e1dc |
|
|
Parag Nemade |
a2e1dc |
https://bugzilla.gnome.org/show_bug.cgi?id=756194
|
|
Parag Nemade |
a2e1dc |
---
|
|
Parag Nemade |
a2e1dc |
libcaribou/xadapter.vala | 13 +++++++++++--
|
|
Parag Nemade |
a2e1dc |
1 file changed, 11 insertions(+), 2 deletions(-)
|
|
Parag Nemade |
a2e1dc |
|
|
Parag Nemade |
a2e1dc |
diff --git a/libcaribou/xadapter.vala b/libcaribou/xadapter.vala
|
|
Parag Nemade |
a2e1dc |
index e786c66..22858b7 100644
|
|
Parag Nemade |
a2e1dc |
--- a/libcaribou/xadapter.vala
|
|
Parag Nemade |
a2e1dc |
+++ b/libcaribou/xadapter.vala
|
|
Parag Nemade |
a2e1dc |
@@ -301,8 +301,17 @@ namespace Caribou {
|
|
Parag Nemade |
a2e1dc |
out string variant_name) {
|
|
Parag Nemade |
a2e1dc |
Xkl.ConfigRec config_rec = new Xkl.ConfigRec ();
|
|
Parag Nemade |
a2e1dc |
config_rec.get_from_server (this.xkl_engine);
|
|
Parag Nemade |
a2e1dc |
- group_name = config_rec.layouts[this.group];
|
|
Parag Nemade |
a2e1dc |
- variant_name = config_rec.variants[this.group];
|
|
Parag Nemade |
a2e1dc |
+
|
|
Parag Nemade |
a2e1dc |
+ if (this.group < config_rec.layouts.length)
|
|
Parag Nemade |
a2e1dc |
+ group_name = config_rec.layouts[this.group];
|
|
Parag Nemade |
a2e1dc |
+ else
|
|
Parag Nemade |
a2e1dc |
+ group_name = "";
|
|
Parag Nemade |
a2e1dc |
+
|
|
Parag Nemade |
a2e1dc |
+ if (this.group < config_rec.variants.length)
|
|
Parag Nemade |
a2e1dc |
+ variant_name = config_rec.variants[this.group];
|
|
Parag Nemade |
a2e1dc |
+ else
|
|
Parag Nemade |
a2e1dc |
+ variant_name = "";
|
|
Parag Nemade |
a2e1dc |
+
|
|
Parag Nemade |
a2e1dc |
if (variant_name == null)
|
|
Parag Nemade |
a2e1dc |
variant_name = "";
|
|
Parag Nemade |
a2e1dc |
|
|
Parag Nemade |
a2e1dc |
--
|
|
Parag Nemade |
a2e1dc |
2.4.3
|