Check for invalid indices in mod/group state API

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2012-03-22 14:31:33 +00:00
parent cfb07724b7
commit 504cc0b858
1 changed files with 6 additions and 0 deletions

View File

@ -472,6 +472,9 @@ int xkb_state_mod_index_is_active(struct xkb_state *state,
{
int ret = 0;
if (idx >= xkb_map_num_mods(state->xkb))
return -1;
if (type & XKB_STATE_DEPRESSED)
ret |= (state->base_mods & (1 << idx));
if (type & XKB_STATE_LATCHED)
@ -507,6 +510,9 @@ int xkb_state_group_index_is_active(struct xkb_state *state,
{
int ret = 0;
if (idx >= xkb_map_num_groups(state->xkb))
return -1;
if (type & XKB_STATE_DEPRESSED)
ret |= (state->base_group == idx);
if (type & XKB_STATE_LATCHED)