Prevent out-of-bounds array access
Fixes https://github.com/itgmania/itgmania/issues/27
This commit is contained in:
@@ -450,7 +450,7 @@ wchar_t InputHandler_MacOSX_HID::DeviceButtonToChar( DeviceButton button, bool b
|
|||||||
{
|
{
|
||||||
CGEventRef event = CGEventCreate(nullptr);
|
CGEventRef event = CGEventCreate(nullptr);
|
||||||
CGEventFlags mods = CGEventGetFlags(event);
|
CGEventFlags mods = CGEventGetFlags(event);
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
UInt32 nModifiers = bUseCurrentKeyModifiers ? (UInt32)mods : 0;
|
UInt32 nModifiers = bUseCurrentKeyModifiers ? (UInt32)mods : 0;
|
||||||
wchar_t sCharCode = KeyCodeToChar( iMacVirtualKey, nModifiers );
|
wchar_t sCharCode = KeyCodeToChar( iMacVirtualKey, nModifiers );
|
||||||
if( sCharCode != 0 )
|
if( sCharCode != 0 )
|
||||||
|
|||||||
@@ -482,7 +482,14 @@ bool KeyboardDevice::DeviceButtonToMacVirtualKey( DeviceButton button, UInt8 &iM
|
|||||||
}
|
}
|
||||||
bInited = true;
|
bInited = true;
|
||||||
}
|
}
|
||||||
iMacVKOut = g_iDeviceButtonToMacVirtualKey[button];
|
if (button < sizeof(g_iDeviceButtonToMacVirtualKey))
|
||||||
|
{
|
||||||
|
iMacVKOut = g_iDeviceButtonToMacVirtualKey[button];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iMacVKOut = 0xFF;
|
||||||
|
}
|
||||||
return iMacVKOut != 0xFF;
|
return iMacVKOut != 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user