From bdc7eb8f07f2c7457de2e07ae6983e6879f21b10 Mon Sep 17 00:00:00 2001 From: Pierre Le Marre Date: Wed, 15 Oct 2025 23:53:24 +0200 Subject: [PATCH] xkb: Fix key type without level names in XkbCopyKeymap A key type that has no level names is legit. Before this commit, `XkbCopyKeymap` would make such level inconsistent by setting its number of levels to 0 while keeping its map entries. It suffices to clear the names array. Fixed by copying the level count from the source type. WARNING: this will trigger an error in `XkbGetNames`, which worked before this commit only by chance. This is fixed in the next commit. (cherry picked from commit 12605989af6e71651c1fbb125277a953259ab7b7) Part-of: --- xkb/xkbUtils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 3dc342e00..090992b41 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -1047,7 +1047,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (dtype->num_levels && dtype->level_names && i < dst->map->num_types) free(dtype->level_names); - dtype->num_levels = 0; + dtype->num_levels = stype->num_levels; dtype->level_names = NULL; }