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 3014

Summary: Checking for duplicate haptic devices broken on Linux.
Product: SDL Reporter: Philipp Wiesemann <philipp.wiesemann>
Component: hapticAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Linux   

Description Philipp Wiesemann 2015-06-14 17:49:05 UTC
The haptic implementation for Linux (src/haptic/linux/SDL_syshaptic.c) tries to check for duplicate haptic devices in MaybeAddDevice(). The check is broken because the array dev_nums with data of previously added devices is on the stack. The contents are therefore not kept between function calls and the comparison is done against (mostly) undefined data.

This problem was indirectly found by Cppcheck pointing out the assigned but unused variable dev_nums.
Comment 1 Ryan C. Gordon 2015-06-16 04:58:28 UTC
Should be fixed in https://hg.libsdl.org/SDL/rev/5f2ac7cec7e9 .

--ryan.