Skip to content

Linux: Fix joystick EV_KEY handling indexing below 0 on keyboard input#2856

Open
tristanbatchler wants to merge 1 commit into
glfw:masterfrom
tristanbatchler:fix-linux-joystick-key-event-bounds
Open

Linux: Fix joystick EV_KEY handling indexing below 0 on keyboard input#2856
tristanbatchler wants to merge 1 commit into
glfw:masterfrom
tristanbatchler:fix-linux-joystick-key-event-bounds

Conversation

@tristanbatchler

Copy link
Copy Markdown

Refreshes #2455 by @ptrToLiam, preserving the original code change and contributor credit.

I can reproduce this today with a Keychron Q3 Max connected over Bluetooth via raylib 6.0 / raylib-zig / Zig 0.16.0 on Linux.

Temporary logging in src/linux_joystick.c showed:

GLFW joystick EV_KEY: code=28 BTN_MISC=256 index=-228 value=0 name=Keychron Q3 Max Keyboard

Without this guard, GLFW indexes:

js->linjs.keyMap[code - BTN_MISC]

with a negative index and crashes.

I tested #2455’s patch against raylib 6.0's bundled GLFW. The src/linux_joystick.c hunk applied cleanly and fixed my repro; raylib's InitWindow completed and the program exited cleanly.

Related: #2484.

Refreshes glfw#2455 by ptrToLiam.

Co-authored-by: MediocreDev <liammaloneirlusa@gmail.com>
@dougbinks dougbinks added bug Bug reports and bugfix pull requests Linux Linux specific (any window system) labels May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug reports and bugfix pull requests Linux Linux specific (any window system)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants