Linux: Avoid out-of-bounds raw keycode array access (#226)

This commit is contained in:
SSimco 2022-09-11 03:00:02 +03:00 committed by GitHub
parent d4879da95c
commit 9a60979242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,12 +170,16 @@ int CemuApp::FilterEvent(wxEvent& event)
{ {
const auto& key_event = (wxKeyEvent&)event; const auto& key_event = (wxKeyEvent&)event;
wxGetKeyState(wxKeyCode::WXK_F17); wxGetKeyState(wxKeyCode::WXK_F17);
g_window_info.keydown[fix_raw_keycode(key_event.GetRawKeyCode(), key_event.GetRawKeyFlags())] = true; uint32 keycode=fix_raw_keycode(key_event.GetRawKeyCode(), key_event.GetRawKeyFlags());
if(keycode<256)
g_window_info.keydown[keycode] = true;
} }
else if(event.GetEventType() == wxEVT_KEY_UP) else if(event.GetEventType() == wxEVT_KEY_UP)
{ {
const auto& key_event = (wxKeyEvent&)event; const auto& key_event = (wxKeyEvent&)event;
g_window_info.keydown[fix_raw_keycode(key_event.GetRawKeyCode(), key_event.GetRawKeyFlags())] = false; uint32 keycode=fix_raw_keycode(key_event.GetRawKeyCode(), key_event.GetRawKeyFlags());
if(keycode<256)
g_window_info.keydown[keycode] = false;
} }
return wxApp::FilterEvent(event); return wxApp::FilterEvent(event);