From: Ran Benita Date: Fri, 7 Feb 2014 15:13:03 +0000 (+0200) Subject: x11: add #actions == #syms check X-Git-Tag: xkbcommon-0.4.1~88 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed18f7dde661e63528a12a63a32d2dceecec01bb;p=platform%2Fupstream%2Flibxkbcommon.git 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 --- diff --git a/src/x11/keymap.c b/src/x11/keymap.c index fa32d16..0eedb30 100644 --- a/src/x11/keymap.c +++ b/src/x11/keymap.c @@ -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;