We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4525

Summary: Fix crash in ALSA_HotplugThread caused by bad return value check
Product: SDL Reporter: Anthony Pesch <inolen>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: patch

Description Anthony Pesch 2019-03-01 00:47:45 UTC
This didn't reproduce on my machine, but I had a user running Ubuntu 18.10 that was getting a segfault due to hints being NULL inside of ALSA_HotplugThread because snd_device_name_hint was returning an error code other than -1.

According to the ALSA documentation, snd_device_name_hint returns 0 on success and a negative error code otherwise. This patch changes the relevant code to check for success by comparing the return value of snd_device_name_hint to 0, rather than checking if it's not equal to -1.
Comment 1 Anthony Pesch 2019-03-01 00:49:11 UTC
Created attachment 3683 [details]
patch
Comment 2 Sam Lantinga 2019-03-17 01:48:41 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/a4824cbecd16