]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
core: Fix out-of-bounds access by TICK event #487
authortmk <hasu@tmk-kbd.com>
Sat, 21 Oct 2017 18:09:20 +0000 (03:09 +0900)
committertmk <hasu@tmk-kbd.com>
Sat, 21 Oct 2017 18:43:04 +0000 (03:43 +0900)
The error is caused in layer_swtich_get_action() and fails to access layer_pressed[][]

tmk_core/common/action.c
tmk_core/common/action_layer.c

index 05aa12eee87af2631f6da268e1df0d253b390fec..305816d4f0ccbcaad729f87663767415b527741f 100644 (file)
@@ -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) {
index 31d659b7aab2d6544dd50f535af5dfe05ce1e370..be316697190cc7b2a1533ca606a570872256967d 100644 (file)
@@ -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) {