Skip to content

Fix crash when SteelSeries Nimbus controller connects (#4816) [$25 Bounty]#18831

Closed
ma-moon wants to merge 1 commit intolibretro:masterfrom
ma-moon:fix-nimbus-clean
Closed

Fix crash when SteelSeries Nimbus controller connects (#4816) [$25 Bounty]#18831
ma-moon wants to merge 1 commit intolibretro:masterfrom
ma-moon:fix-nimbus-clean

Conversation

@ma-moon
Copy link
Copy Markdown

@ma-moon ma-moon commented Mar 15, 2026

Description

This PR fixes a segmentation fault that occurs when connecting a SteelSeries Nimbus controller (and potentially other HID controllers) on macOS.

Root Cause

The crash was caused by NULL pointer dereferences in three functions:

  • iohidmanager_hid_device_add() - accessed hid->slots before checking if hid was NULL
  • iohidmanager_hid_device_remove() - accessed hid->slots before checking if hid was NULL
  • iohidmanager_hid_device_input_callback() - accessed hid->hats/axes/buttons without NULL check

The hid_driver_get_data() function can return NULL when the HID driver is not properly initialized, which can happen during controller hot-plug events.

Fix

Added early NULL checks at the beginning of each affected function to prevent dereferencing NULL pointers.

Changes

  • input/drivers_hid/iohidmanager_hid.c: Added NULL pointer checks in 3 functions
    • iohidmanager_hid_device_add(): Check hid before accessing hid->slots
    • `iohidmanager_hid_device_remove()): Check hid before accessing hid->slots
    • `iohidmanager_hid_device_input_callback()): Check hid and adapter before use

Testing

Bounty

This fix addresses issue #4816 with a $25 bounty.

…ereference)

- Add NULL checks for hid pointer in iohidmanager_hid_device_add(),
  iohidmanager_hid_device_remove(), and iohidmanager_hid_device_input_callback()
- Prevents segmentation fault when HID driver data is not initialized
- Fixes issue libretro#4816
@warmenhoven
Copy link
Copy Markdown
Collaborator

This was fixed a long time ago already and just wasn't closed. Were you able to confirm that this still exists?

@ma-moon
Copy link
Copy Markdown
Author

ma-moon commented Mar 22, 2026

CI passes. Ready for review.

@warmenhoven
Copy link
Copy Markdown
Collaborator

You didn't even read my comment nor the full set of comments on the original issue. This was fixed a long, long time ago.

@warmenhoven
Copy link
Copy Markdown
Collaborator

Incidentally I did get out my Nimbus and tried with HID and confirmed it is working without this fix.

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