mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 02:31:46 +00:00
Check scancode before use in glfwGetKeyName
This commit is contained in:
parent
a491b0698c
commit
5f1631cb0e
@ -142,6 +142,8 @@ information on what to include when reporting a bug.
|
|||||||
window (#1499)
|
window (#1499)
|
||||||
- [Win32] Bugfix: Disabled cursor mode interfered with some non-client actions
|
- [Win32] Bugfix: Disabled cursor mode interfered with some non-client actions
|
||||||
- [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622)
|
- [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622)
|
||||||
|
- [Win32] Bugfix: `glfwGetKeyName` could access out of bounds and return an
|
||||||
|
invalid pointer
|
||||||
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
||||||
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
||||||
- [Cocoa] Removed dependency on the CoreVideo framework
|
- [Cocoa] Removed dependency on the CoreVideo framework
|
||||||
|
@ -1516,6 +1516,13 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
|
if (scancode < 0 || scancode > 0xff ||
|
||||||
|
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const int key = _glfw.ns.keycodes[scancode];
|
const int key = _glfw.ns.keycodes[scancode];
|
||||||
|
|
||||||
UInt32 deadKeyState = 0;
|
UInt32 deadKeyState = 0;
|
||||||
|
@ -2026,6 +2026,13 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||||||
|
|
||||||
const char* _glfwPlatformGetScancodeName(int scancode)
|
const char* _glfwPlatformGetScancodeName(int scancode)
|
||||||
{
|
{
|
||||||
|
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
||||||
|
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return _glfw.win32.keynames[_glfw.win32.keycodes[scancode]];
|
return _glfw.win32.keynames[_glfw.win32.keycodes[scancode]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2862,6 +2862,13 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (!_glfw.x11.xkb.available)
|
if (!_glfw.x11.xkb.available)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (scancode < 0 || scancode > 0xff ||
|
||||||
|
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const int key = _glfw.x11.keycodes[scancode];
|
const int key = _glfw.x11.keycodes[scancode];
|
||||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
||||||
scancode, _glfw.x11.xkb.group, 0);
|
scancode, _glfw.x11.xkb.group, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user