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 1085

Summary: Jump to NULL function pointer on ALSA_OpenDevice when not SDL_AUDIO_DRIVER_ALSA_DYNAMIC
Product: SDL Reporter: Bruno <bonbons67>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Linux   
Attachments: Fix segfault in ALSA_OpenDevice()

Description Bruno 2010-12-16 02:41:51 UTC
Created attachment 550 [details]
Fix segfault in ALSA_OpenDevice()

When alsa is linked to libsdl instead of being loaded on demand at runtime the alsa macro snd_pcm_hw_params_alloca(ptr); misbehaves.

That macro calls snd_pcm_hw_params_sizeof() in order to determine the amount of memory to allocate but due to mis-placed define that function is replaced with ALSA_snd_pcm_hw_params_sizeof by preprocessor (and in case of link to alsa that function pointer is initialized to itself).

Attached patch fixes the issue.
Comment 1 Sam Lantinga 2011-02-16 04:09:02 UTC
This patch is in, thanks!
http://hg.libsdl.org/SDL/rev/192f2d605339