X Tutup
Skip to content

[backend/GLFW] Added bounds check#5621

Merged
raysan5 merged 2 commits intoraysan5:masterfrom
CrackedPixel:fix-glfw-crash-controllerconnected
Mar 4, 2026
Merged

[backend/GLFW] Added bounds check#5621
raysan5 merged 2 commits intoraysan5:masterfrom
CrackedPixel:fix-glfw-crash-controllerconnected

Conversation

@CrackedPixel
Copy link
Contributor

@CrackedPixel CrackedPixel commented Mar 4, 2026

I ran into an issue where my apps were crashing if you connect a gamepad during runtime. Only on linux.

I found this with the same issue, and it showed a commit where it "started": #4954

in that issue, this commit was noted as the culprit.. and if you set the MAX_GAMEPAD_NAME_LENGTH back to 64 it masks the issue

If you add a debug log to this function, you will see the jid is beyond the array index. im not sure how glfw decides the IDs but i believe its some platform specific code they have that makes it not happen on windows? or maybe with the alignment its just been lucky.

This must be why it has different behavior on different versions of raylib or different runs (RLGL has null context, fps cap changes, etc), because its overwriting random memory with the overflow

@CrackedPixel CrackedPixel changed the title [platform/glfw] Added bounds check [backend/GLFW] Added bounds check Mar 4, 2026
@CrackedPixel CrackedPixel force-pushed the fix-glfw-crash-controllerconnected branch from 26f578d to 099d8db Compare March 4, 2026 04:28
@CrackedPixel CrackedPixel force-pushed the fix-glfw-crash-controllerconnected branch from 099d8db to 406ad3a Compare March 4, 2026 04:37
@raysan5 raysan5 merged commit de720a8 into raysan5:master Mar 4, 2026
16 checks passed
@CrackedPixel CrackedPixel deleted the fix-glfw-crash-controllerconnected branch March 4, 2026 07:40
@raysan5
Copy link
Owner

raysan5 commented Mar 4, 2026

@CrackedPixel Nice! Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup