diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2025-03-20 10:37:53 +1000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2025-04-07 15:45:50 +0000 |
commit | cab9017485566da656b12b686e571d42b0f28afb (patch) | |
tree | 99dfaf24a33d03b75b00b058d10a7c3de1b6a8f0 /hw/xnest/Color.h | |
parent | c445167da63a3ab454b79f6c99a7fb5bf46ab0bd (diff) |
This fixes a crash when we try to send focus events and dereference
FollowKeyboardWin (0x3) as WindowPtr.
A device set to XSetDeviceFocus(FollowKeyboard) is supposed to follow
the focus of the corresponding master device. During ActivateKeyboard
a slave device is detached from the master for the duration for the grab
so we don't actually have a master to follow - leaving our oldWin set to
the FollowKeyboardWin constant. This later crashes when we try to
dereference it.
Fix this by getting the current master (if any), or the saved master (if
temporarily detached due to a grab). And if failing that, use the VCK
as fallback device - that is technically wrong but it's such a niche use
case that it shouldn't matter.
Reproducer:
window = XCreateSimpleWindow(...)
deviceid = any device that is IsXExtensionKeyboard device
XSetDeviceFocus(deviceid, FollowKeyboard, ...)
XGrabDevice(deviceid, window, ...)
Fixes: f01ee198ff0c ("dix: don't use inputInfo.keyboard to get the focus window in ActivateKbdGrab")
Found-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1870>
Diffstat (limited to 'hw/xnest/Color.h')
0 files changed, 0 insertions, 0 deletions