[PATCH] keyborad: Since the qemu_input_map_qnum_to_qcode array has a length of 254, the values in the keycodes array exceed the valid range

yanlonglong posted 1 patch 1 week, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260402065451.20380-1-yanlonglong@kylinos.cn
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>
ui/keymaps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] keyborad: Since the qemu_input_map_qnum_to_qcode array has a length of 254, the values in the keycodes array exceed the valid range
Posted by yanlonglong 1 week, 2 days ago
Signed-off-by: yanlonglong <yanlonglong@kylinos.cn>
---
 ui/keymaps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/keymaps.c b/ui/keymaps.c
index 2359dbfe7e..7815c4e6d3 100644
--- a/ui/keymaps.c
+++ b/ui/keymaps.c
@@ -249,7 +249,7 @@ int keysym2scancode(kbd_layout_t *k, int keysym,
          */
         for (i = 0; i < keysym2code->count; i++) {
             QKeyCode qcode = qemu_input_key_number_to_qcode
-                (keysym2code->keycodes[i]);
+                (keysym2code->keycodes[i] & SCANCODE_KEYMASK);
             if (kbd && qkbd_state_key_get(kbd, qcode)) {
                 return keysym2code->keycodes[i];
             }
-- 
2.43.0