x11: add #actions == #syms check

This must always hold (but if there are no actions, #actions==0), and
explicitly ensures there won't be a division-by-zero a bit below.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2014-02-07 17:13:03 +02:00
parent 125bb19ede
commit ed18f7dde6
1 changed files with 3 additions and 0 deletions

View File

@ -471,9 +471,12 @@ get_actions(struct xkb_keymap *keymap, xcb_connection_t *conn,
for (int i = 0; i < acts_count_length; i++) {
xcb_xkb_key_sym_map_t *wire_sym_map = sym_maps_iter.data;
int syms_length = xcb_xkb_key_sym_map_syms_length(wire_sym_map);
uint8_t wire_count = *acts_count_iter;
struct xkb_key *key = &keymap->keys[reply->firstKeyAction + i];
FAIL_UNLESS(wire_count == 0 || wire_count == syms_length);
for (int j = 0; j < wire_count; j++) {
xcb_xkb_action_t *wire_action = acts_iter.data;
const xkb_layout_index_t group = j / wire_sym_map->width;