diff options
author | Matthieu Herrb <matthieu@herrb.eu> | 2024-05-04 13:36:07 +0200 |
---|---|---|
committer | Matthieu Herrb <matthieu@herrb.eu> | 2024-05-04 14:27:40 +0200 |
commit | 3f354d20f5bc0276e27faa7fb5f6356319aa32c3 (patch) | |
tree | c725c8907b5b3023451197f5ee87e792db768876 | |
parent | 0b4873ce55e3afe2e1716ef4a21cd94a7ae96e64 (diff) |
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>
-rw-r--r-- | symbols.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |