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 3343

Summary: SDL_joystick: crash
Product: SDL Reporter: Marcos Souza <marcos.souza.org>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: philipp.wiesemann
Version: 2.0.4   
Hardware: x86_64   
OS: Linux   

Description Marcos Souza 2016-05-24 01:58:21 UTC
I'm using Fedora 23, and the version of PCSXR is "svn" on the about dialog, so the version affected is the latest on Fedora repositories.

Version-Release number of selected component (if applicable):
SDL 2.0.4

Steps to Reproduce:
1. Plug an USB controller
2. Open PCSXR and click on Configure Controllers

Actual results:
Crash

Expected results:
Open window to map buttons of the controller

Additional info:
backtrace

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7f1ba00 (LWP 20613)]
SDL_JoystickName_REAL (joystick=0x1) at /usr/src/debug/SDL2-2.0.4/src/joystick/SDL_joystick.c:403
403	    return (joystick->name);
Missing separate debuginfos, use: dnf debuginfo-install gvfs-client-1.26.3-1.fc23.x86_64 libcanberra-0.30-10.fc23.x86_64 libcanberra-gtk3-0.30-10.fc23.x86_64 libogg-1.3.2-4.fc23.x86_64 libtdb-1.3.9-1.fc23.x86_64 libtool-ltdl-2.4.6-8.fc23.x86_64 libvorbis-1.3.4-5.fc23.x86_64 PackageKit-gtk3-module-1.0.11-1.fc23.x86_64
(gdb) bt
#0  0x00007ffff5843845 in SDL_JoystickName_REAL (joystick=0x1) at /usr/src/debug/SDL2-2.0.4/src/joystick/SDL_joystick.c:403
#1  0x00000000004063df in PADconfigure () at cfg-gtk.c:610
#2  0x00000000004063df in PADconfigure () at cfg-gtk.c:818
#3  0x0000000000402732 in main (argc=2, argv=0x7fffffffdf08) at cfg-gtk.c:863
Comment 1 Philipp Wiesemann 2016-05-24 20:02:24 UTC
SDL_JoystickName() should be called with an SDL_Joystick pointer in SDL 2.0.

The back trace looks like it was called with an integer. This is wrong.

The integer version is SDL_JoystickNameForIndex() in SDL 2.0.
Comment 2 Sam Lantinga 2017-08-12 02:21:40 UTC
Looks like an application API error