projects
/
platform
/
upstream
/
libxkbcommon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cfb0772
)
Check for invalid indices in mod/group state API
author
Daniel Stone
<daniel@fooishbar.org>
Thu, 22 Mar 2012 14:31:33 +0000
(14:31 +0000)
committer
Daniel Stone
<daniel@fooishbar.org>
Thu, 22 Mar 2012 14:31:33 +0000
(14:31 +0000)
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
src/state.c
patch
|
blob
|
history
diff --git
a/src/state.c
b/src/state.c
index
d63d4c9
..
1802f84
100644
(file)
--- a/
src/state.c
+++ b/
src/state.c
@@
-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)