summaryrefslogtreecommitdiff
path: root/symbols.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2024-05-04 13:36:07 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2024-05-04 14:27:40 +0200
commit3f354d20f5bc0276e27faa7fb5f6356319aa32c3 (patch)
treec725c8907b5b3023451197f5ee87e792db768876 /symbols.c
parent0b4873ce55e3afe2e1716ef4a21cd94a7ae96e64 (diff)
Symbols: resize the syms array when removing NoSymbolHEADmaster
On OpenBSD, with malloc_conf=S, the recallocarray() code detects a size mismatch in ResizeKeyGroup when numLevels[group] doesn't match the allocated size of syms[group]. Should fix https://gitlab.freedesktop.org/xorg/app/xkbcomp/-/issues/25 Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Part-of: <https://gitlab.freedesktop.org/xorg/app/xkbcomp/-/merge_requests/24>
Diffstat (limited to 'symbols.c')
-rw-r--r--symbols.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/symbols.c b/symbols.c
index 69cbe32..55dc197 100644
--- a/symbols.c
+++ b/symbols.c
@@ -957,6 +957,9 @@ AddSymbolsToKey(KeyInfo *key, XkbDescPtr xkb, const char *field,
for (int i = key->numLevels[ndx] - 1;
(i >= 0) && (key->syms[ndx][i] == NoSymbol); i--)
{
+ key->syms[ndx] = recallocarray(key->syms[ndx], key->numLevels[ndx],
+ key->numLevels[ndx]-1, sizeof(KeySym));
+ /* XXX resize keys->acts too ? */
key->numLevels[ndx]--;
}
return True;