From 3f354d20f5bc0276e27faa7fb5f6356319aa32c3 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 4 May 2024 13:36:07 +0200 Subject: Symbols: resize the syms array when removing NoSymbol 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 Part-of: --- symbols.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- cgit v1.2.3