SDL/src
Cameron Gutman 4aab2342e9 Check for device disconnection in HIDAPI_JoystickOpen()
HIDAPI joystick drivers may call HIDAPI_JoystickDisconnected() in their
UpdateDevice() function during HIDAPI_JoystickOpen(). If they do this
today, the opened joystick will end up partially initialized (no name,
path, mapping GUID, etc.) because HIDAPI_GetDeviceByIndex() will no
longer be able to find the SDL_HIDAPI_Device for the removed joystick.

Worse still, joystick->hwdata->device becomes a dangling freed pointer
the next time HIDAPI_UpdateDeviceList() is called. This leads to a UAF
when the application or SDL calls SDL_JoystickClose() on this joystick.

Fix all this by checking if the device no longer has any associated
joysticks after calling UpdateDevice() and failing the open call if so.

(cherry picked from commit 435e7ce663b7e568086c5dc0fb1bb889e41a3ed1)
2023-10-17 22:18:52 -05:00
..
atomic Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
audio pulseaudio: Stop the threaded mainloop before destroying the context. 2023-10-13 09:36:06 -04:00
core SDL_dbus.h: define DBUS_TIMEOUT_USE_DEFAULT if not already defined. 2023-09-21 01:32:50 +03:00
cpuinfo Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
dynapi updated dynapi after SDL_GDKGetDefaultUser addition 2023-08-25 19:03:40 +03:00
events Fix automated tests using the dummy video driver 2023-09-30 11:21:10 -04:00
file SDL_RWFromMem, SDL_RWFromConstMem: reject negative size parameters. 2023-07-10 00:14:35 +03:00
filesystem – gdk: Add SDL_GDKGetDefaultUser, SDL_GetPrefPath implementation 2023-08-25 10:41:14 -04:00
haptic Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
hidapi Quiet spurious warning 2023-08-13 13:54:18 -07:00
joystick Check for device disconnection in HIDAPI_JoystickOpen() 2023-10-17 22:18:52 -05:00
libm Updated copyright for 2023 2023-01-09 09:48:21 -08:00
loadso Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
locale Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
main Unaligned stacks on i686-w64-mingw32, may lead to crashes (#7607) 2023-07-10 03:05:32 +03:00
misc Allow the use of posix_spawn() instead of vfork/execlp() 2023-09-30 16:48:51 +02:00
power Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
render triangle: don't read destination pixel when you're going to discard it anyways 2023-10-05 13:46:28 +02:00
sensor Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!) 2023-03-09 15:23:59 -08:00
stdlib SDL_iconv_string() defaults to UTF-8 2023-09-24 17:28:06 -07:00
test Fix sdltest_randomAsciiStringWithMaximumLength() where it requests a string a size 0 2023-10-13 20:23:01 +02:00
thread Unaligned stacks on i686-w64-mingw32, may lead to crashes (#7607) 2023-07-10 03:05:32 +03:00
timer Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
video x11: Properly check for XInput2 support before using it. 2023-10-11 01:09:46 -04:00
SDL.c Unaligned stacks on i686-w64-mingw32, may lead to crashes (#7607) 2023-07-10 03:05:32 +03:00
SDL_assert.c emscripten: Restore compatibility with existing emsdk releases. 2023-09-20 14:35:51 -04:00
SDL_assert_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_dataqueue.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_dataqueue.h dataqueue: Make thread safe. 2023-03-02 16:43:44 -05:00
SDL_error.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_error_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_guid.c Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_hints.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_hints_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_internal.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_list.c Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_list.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_log.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_log_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_utils.c Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_utils_c.h Don't bother re-encoding Latin1 characters in the ASCII range 2023-06-04 05:40:07 -07:00