qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 06/26] qemu-keymap: properly check return from xkb_keymap_


From: Richard Henderson
Subject: Re: [PATCH v2 06/26] qemu-keymap: properly check return from xkb_keymap_mod_get_index
Date: Tue, 27 Jun 2023 08:55:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 6/26/23 23:59, Alex Bennée wrote:
We can return XKB_MOD_INVALID which rightly gets flagged by sanitisers
as an overly wide shift attempt.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
  qemu-keymap.c | 24 ++++++++++++++++--------
  1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/qemu-keymap.c b/qemu-keymap.c
index 229866e004..8c80f7a4ed 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -140,6 +140,18 @@ static void usage(FILE *out)
              names.options ?: "-");
  }
+static xkb_mod_mask_t get_mod(struct xkb_keymap *map, const char *name)
+{
+    xkb_mod_index_t mod;
+    xkb_mod_mask_t mask = 0;
+
+    mod = xkb_keymap_mod_get_index(map, name);
+    if (mod != XKB_MOD_INVALID) {
+        mask = (1 << mod);
+    }
+    return mask;
+}

You have yet to answer Peter's question -- asked twice -- about what changes in the keymaps with this. If nothing, should it in fact be an assert instead?


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]