From c5e2bc7e2de81a5ca32d7aac3412cbb78386d3f2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 10:51:10 +0000 Subject: import libgnomekbd-3.26.0-3.el7 --- diff --git a/SOURCES/libgnomekbd-fix-invalid-layout-crash.patch b/SOURCES/libgnomekbd-fix-invalid-layout-crash.patch new file mode 100644 index 0000000..ce48359 --- /dev/null +++ b/SOURCES/libgnomekbd-fix-invalid-layout-crash.patch @@ -0,0 +1,84 @@ +From 3ec4bc6648c447a28bac0fe3cbdbacf887f2a762 Mon Sep 17 00:00:00 2001 +From: Antonio Ospite +Date: Fri, 10 Nov 2017 12:45:25 +0100 +Subject: [PATCH] Fix a regression after commit 5f260b2b73a3 (Handle + XkbGetKeyboard() failing) +X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM/Vb;]yA5\I~93>J<_`<4)A{':UrE + +Passing names with invalid values to +gkbd_keyboard_drawing_set_keyboard() makes the library crash with +a segmentation fault. + +This can be reproduced with gkbd-keyboard-display: + +----------------------------------------------------------------------- +$ gdb --eval-comman=run --args gkbd-keyboard-display -l "INVALID" +... +Thread 1 "gkbd-keyboard-d" received signal SIGSEGV, Segmentation fault. +0x00007ffff54dec2e in get_preferred_height_for_width (...) + at gkbd-keyboard-drawing.c:2147 +2147 drawing->xkb->geom->width_mm; +----------------------------------------------------------------------- + +The same issue could be reproduced also with the test programs: + + $ ./test/gkbd-keyboard-drawing-test --geometry="INVALID" + $ ./test/python_test.py "INVALID" + +The spirit of commit 5f260b2b73a3 seems to be: let's not fail +prematurely in gkbd_keyboard_drawing_init() because it could still be +possible to get the XKeyboard in gkbd_keyboard_drawing_set_keyboard(). + +However in the implementation gkbd_keyboard_drawing_set_keyboard() ends +up returning always TRUE, unconditionally, even when calling +XkbGetKeyboard() fails there too. + +Fix the issue by returning FALSE in gkbd_keyboard_drawing_set_keyboard() +when no keyboard was found, at that point there should really not be any +chances anymore to get the keyboard the user asked for. + +While at it also remove the initalization of drawing->xkb in +gkbd_keyboard_drawing_set_keyboard() which is not needed and might hide +future bugs. + +https://bugzilla.gnome.org/show_bug.cgi?id=780151 +--- + libgnomekbd/gkbd-keyboard-drawing.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c +index da526d2..7c68fc3 100644 +--- a/libgnomekbd/gkbd-keyboard-drawing.c ++++ b/libgnomekbd/gkbd-keyboard-drawing.c +@@ -2271,7 +2271,6 @@ gkbd_keyboard_drawing_set_keyboard (GkbdKeyboardDrawing * drawing, + free_cdik (drawing); + if (drawing->xkb) + XkbFreeKeyboard (drawing->xkb, 0, TRUE); /* free_all = TRUE */ +- drawing->xkb = NULL; + + if (names) { + drawing->xkb = +@@ -2296,12 +2295,13 @@ gkbd_keyboard_drawing_set_keyboard (GkbdKeyboardDrawing * drawing, + drawing->xkbOnDisplay = TRUE; + } + +- if (drawing->xkb) { +- XkbSelectEventDetails (drawing->display, XkbUseCoreKbd, +- XkbIndicatorStateNotify, +- drawing->xkb->indicators->phys_indicators, +- drawing->xkb->indicators->phys_indicators); +- } ++ if (!drawing->xkb) ++ return FALSE; ++ ++ XkbSelectEventDetails (drawing->display, XkbUseCoreKbd, ++ XkbIndicatorStateNotify, ++ drawing->xkb->indicators->phys_indicators, ++ drawing->xkb->indicators->phys_indicators); + + alloc_cdik (drawing); + +-- +2.15.0 \ No newline at end of file diff --git a/SPECS/libgnomekbd.spec b/SPECS/libgnomekbd.spec index 969a973..a8dac57 100644 --- a/SPECS/libgnomekbd.spec +++ b/SPECS/libgnomekbd.spec @@ -1,11 +1,13 @@ Name: libgnomekbd Version: 3.26.0 -Release: 1%{?dist} +Release: 3%{?dist} Summary: A keyboard configuration library License: LGPLv2+ URL: http://gswitchit.sourceforge.net Source0: http://download.gnome.org/sources/libgnomekbd/3.26/libgnomekbd-%{version}.tar.xz +# https://bugzilla.redhat.com/show_bug.cgi?id=1448326 +Patch0: libgnomekbd-fix-invalid-layout-crash.patch BuildRequires: gtk3-devel >= 3.0.0 BuildRequires: cairo-devel @@ -38,6 +40,7 @@ developing applications that use libgnomekbd. %prep %setup -q +%patch0 -p1 %build %configure --disable-static \ @@ -96,6 +99,12 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %changelog +* Tue Mar 26 2019 David King - 3.26.0-3 +- Apply invalid layout patch (#1448326) + +* Mon Mar 25 2019 David King - 3.26.0-2 +- Fix crash with invalid layout (#1448326) + * Wed Sep 13 2017 Kalev Lember - 3.26.0-1 - Update to 3.26.0 - Resolves: #1569289