From: tmk Date: Sat, 21 Oct 2017 18:09:20 +0000 (+0900) Subject: core: Fix out-of-bounds access by TICK event #487 X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=df7ce59d1cbe04cd6bd2e689eff7a79bc6cb070f;p=max%2Ftmk_keyboard.git core: Fix out-of-bounds access by TICK event #487 The error is caused in layer_swtich_get_action() and fails to access layer_pressed[][] --- diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 05aa12ee..305816d4 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -531,6 +531,8 @@ void clear_keyboard_but_mods(void) bool is_tap_key(keyevent_t event) { + if (IS_NOEVENT(event)) { return false; } + action_t action = layer_switch_get_action(event); switch (action.kind.id) { diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 31d659b7..be316697 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -148,6 +148,8 @@ static uint8_t layer_pressed[MATRIX_ROWS][MATRIX_COLS] = {}; #endif action_t layer_switch_get_action(keyevent_t event) { + if (IS_NOEVENT(event)) return (action_t)ACTION_NO; + uint8_t layer = 0; #ifndef NO_TRACK_KEY_PRESS if (event.pressed) {