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 5155 - [Patch] HIDAPI_JoystickDisconnected incorrect array shift
Summary: [Patch] HIDAPI_JoystickDisconnected incorrect array shift
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-23 16:52 UTC by Anthony Pesch
Modified: 2020-05-30 04:22 UTC (History)
0 users

See Also:


Attachments
scale memmove size by sizeof(SDL_JoystickID) (1.15 KB, patch)
2020-05-23 16:52 UTC, Anthony Pesch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Pesch 2020-05-23 16:52:19 UTC
Created attachment 4355 [details]
scale memmove size by sizeof(SDL_JoystickID)

Hi Sam,

I was looking into my own input bug and noticed an issue in the HIDAPI code while looking over it. I don't have a controller that goes down this path to test and try to provoke the issue, but it looks pretty straight forward.

The memmove to shift the joystick id array on disconnect isn't scaling the size by sizeof(SDL_JoystickID), likely corrupting the ids on disconnect.
Comment 1 Sam Lantinga 2020-05-30 04:22:32 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/44fbeca0872e