mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 09:39:15 +00:00
Merge pull request #988 from ishitatsuyuki/xcb-segfault
Fix XCB keyboard mapping size calculation
This commit is contained in:
commit
ee5b371576
|
@ -655,7 +655,7 @@ static inline bool fill_keycodes(struct obs_core_hotkeys *hotkeys)
|
|||
context->min_keycode = setup->min_keycode;
|
||||
|
||||
cookie = xcb_get_keyboard_mapping(connection,
|
||||
mincode, maxcode - mincode - 1);
|
||||
mincode, maxcode - mincode + 1);
|
||||
|
||||
reply = xcb_get_keyboard_mapping_reply(connection, cookie, &error);
|
||||
|
||||
|
@ -667,7 +667,7 @@ static inline bool fill_keycodes(struct obs_core_hotkeys *hotkeys)
|
|||
const xcb_keysym_t *keysyms = xcb_get_keyboard_mapping_keysyms(reply);
|
||||
int syms_per_code = (int)reply->keysyms_per_keycode;
|
||||
|
||||
context->num_keysyms = (maxcode - mincode) * syms_per_code;
|
||||
context->num_keysyms = (maxcode - mincode + 1) * syms_per_code;
|
||||
context->syms_per_code = syms_per_code;
|
||||
context->keysyms = bmemdup(keysyms,
|
||||
sizeof(xcb_keysym_t) * context->num_keysyms);
|
||||
|
|
Loading…
Reference in a new issue