From df7ce59d1cbe04cd6bd2e689eff7a79bc6cb070f Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 22 Oct 2017 03:09:20 +0900 Subject: [PATCH] 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[][] --- tmk_core/common/action.c | 2 ++ tmk_core/common/action_layer.c | 2 ++ 2 files changed, 4 insertions(+) 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) { -- 2.46.2