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 - Checking for duplicate haptic devices broken on Linux.
Summary: Checking for duplicate haptic devices broken on Linux.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: haptic (show other bugs)
Version: HG 2.0
Hardware: All Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-14 17:49 UTC by Philipp Wiesemann
Modified: 2015-06-16 04:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.