Skip to content

Safety check to prevent crash on macOS when IOHIDManagerCopyDevices() returns NULL#359

Open
Timac wants to merge 1 commit intosignal11:masterfrom
Timac:SafetyCheckCFSetGetCount
Open

Safety check to prevent crash on macOS when IOHIDManagerCopyDevices() returns NULL#359
Timac wants to merge 1 commit intosignal11:masterfrom
Timac:SafetyCheckCFSetGetCount

Conversation

@Timac
Copy link
Copy Markdown

@Timac Timac commented Sep 25, 2017

I have seen several crashes on macOS 10.12.6 caused by the fact that IOHIDManagerCopyDevices() returned NULL. Calling CFSetGetCount() on a NULL CFSetRef causes a crash. The fix consists of checking if the CFSetRef is not NULL before using it. Here is a backtrace of a crash:

0x00007fffd04a5118 CFSetGetCount + 24
0x000000010c15147f hid_enumerate (hid.c:427)
0x000000010c151acc hid_open (hid.c:529)

…IOHIDManagerCopyDevices() returned NULL. Calling CFSetGetCount() on a NULL CFSetRef causes a crash. The fix consists of checking if the CFSetRef is not NULL before using it. Here is a backtrace of a crash:

0x00007fffd04a5118 CFSetGetCount + 24
0x000000010c15147f hid_enumerate (hid.c:427)
0x000000010c151acc hid_open (hid.c:529)
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.

1 participant