From 22aa25cea6d5dcdd531de34abc1e493df1a8eda2 Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Wed, 18 Oct 2023 17:52:37 +0200 Subject: [PATCH] Fix[keyboard]: handle OOB keyDown requests --- .../lwjgl/lwjglx/src/main/java/org/lwjgl/input/Keyboard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lwjgl/lwjglx/src/main/java/org/lwjgl/input/Keyboard.java b/modules/lwjgl/lwjglx/src/main/java/org/lwjgl/input/Keyboard.java index d1ff345b96..1fa1a92af2 100644 --- a/modules/lwjgl/lwjglx/src/main/java/org/lwjgl/input/Keyboard.java +++ b/modules/lwjgl/lwjglx/src/main/java/org/lwjgl/input/Keyboard.java @@ -395,7 +395,7 @@ private static void read() { public static boolean isKeyDown(int key) { if (!created) throw new IllegalStateException("Keyboard must be created before you can query key state"); - if(key >= KEYBOARD_SIZE) return false; + if(key < 0 || key >= keyDownBuffer.limit()) return false; return keyDownBuffer.get(key) != 0; }