mlabbe/investickgator

Segmentation fault (prebuilt binaries)

stolk opened this issue · 2 comments

stolk commented

When running the prebuilt binaries from github assets, on Linux, pressing a trigger buttons on Steam Controller:

bram@Workstation:~/investickgator-1.0.1/bin/linux_x64$ ./iv 
Starting joystick subsystem with xinput enabled: 1

added device id 0 with name Microsoft X-Box 360 pad
Joystick instance id: 0

─── Output/messages ────────────────────────────────────────────────────────────
Starting joystick subsystem with xinput enabled: 1

added device id 0 with name Microsoft X-Box 360 pad
Joystick instance id: 0

added device id 1 with name Steam Controller
Joystick instance id: 1

Thread 1 "iv" received signal SIGSEGV, Segmentation fault.
0x000000000047d814 in ?? ()
─── Assembly ───────────────────────────────────────────────────────────────────
0x000000000047d814 ? movzbl (%rax),%eax
0x000000000047d817 ? movzbl %al,%edx
0x000000000047d81a ? movzbl -0x3c(%rbp),%ecx
0x000000000047d81e ? mov    -0x38(%rbp),%rax
0x000000000047d822 ? mov    %ecx,%esi
0x000000000047d824 ? mov    %rax,%rdi
0x000000000047d827 ? call   0x44a5ab
─── Expressions ────────────────────────────────────────────────────────────────
─── History ────────────────────────────────────────────────────────────────────
─── Memory ─────────────────────────────────────────────────────────────────────
─── Registers ──────────────────────────────────────────────────────────────────
   rax 0x000080000034d458     rbx 0x00000000007ca420     rcx 0x0000000000350032 
   rdx 0x0000000000000002     rsi 0x0000000000000002     rdi 0x0000000000d46670 
   rbp 0x00007fffffffd440     rsp 0x00007fffffffd3f0      r8 0x0000000000000000 
    r9 0x0000000000000000     r10 0x0000000000000000     r11 0x0000000000000246 
   r12 0x0000000000000001     r13 0x0000000000000400     r14 0x0000000000000002 
   r15 0x00000000ffcc5c28     rip 0x000000000047d814  eflags [ IF RF ]          
    cs 0x00000033              ss 0x0000002b              ds 0x00000000         
    es 0x00000000              fs 0x00000000              gs 0x00000000         
    k0 0x0000000000000000      k1 0x0000000000000000      k2 0x0000000000000000 
    k3 0x0000000000000000      k4 0x0000000000000000      k5 0x0000000000000000 
    k6 0x0000000000000000      k7 0x0000000000000000 
─── Source ─────────────────────────────────────────────────────────────────────
─── Stack ──────────────────────────────────────────────────────────────────────
[0] from 0x000000000047d814
(no arguments)
[1] from 0x000000000047dc2c
(no arguments)
[+]
─── Threads ────────────────────────────────────────────────────────────────────
[2] id 495191 name SDLTimer from 0x00007ffff7f9231e in __futex_abstimed_wait_common64+237 at ../sysdeps/nptl/futex-internal.c:74
[1] id 495187 name iv from 0x000000000047d814
────────────────────────────────────────────────────────────────────────────────
>>> where
#0  0x000000000047d814 in ?? ()
#1  0x000000000047dc2c in ?? ()
#2  0x000000000047dded in ?? ()
#3  0x000000000044a923 in ?? ()
#4  0x000000000043f7ed in ?? ()
#5  0x000000000043f863 in ?? ()
#6  0x000000000043f812 in ?? ()
#7  0x0000000000438874 in ?? ()
#8  0x0000000000403b11 in ?? ()
#9  0x00007ffff7be2565 in __libc_start_main (main=0x4038f0, argc=1, argv=0x7fffffffdef8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdee8) at ../csu/libc-start.c:332
#10 0x0000000000404589 in ?? ()
>>> 

stolk commented

I've built it from source... valgrind finds invalid read when I press the trigger of the Steam Controller.

==544980== Invalid read of size 4
==544980==    at 0x492A9DA: HandleHat (SDL_sysjoystick.c:648)
==544980==    by 0x492A9DA: HandleInputEvents (SDL_sysjoystick.c:766)
==544980==    by 0x492A9DA: SDL_SYS_JoystickUpdate (SDL_sysjoystick.c:811)
==544980==    by 0x48A0CEF: SDL_JoystickUpdate_REAL (SDL_joystick.c:684)
==544980==    by 0x48976C4: SDL_PumpEvents_REAL (SDL_events.c:406)
==544980==    by 0x48976C4: SDL_WaitEventTimeout_REAL (SDL_events.c:436)
==544980==    by 0x48976C4: SDL_PollEvent_REAL (SDL_events.c:418)
==544980==    by 0x40291F: sim (investickgator.c:296)
==544980==    by 0x4026E0: main (investickgator.c:458)
==544980==  Address 0x9750870 is 0 bytes after a block of size 16 alloc'd
==544980==    at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==544980==    by 0x492A5B7: allocate_hatdata (SDL_sysjoystick.c:433)
==544980==    by 0x492A5B7: ConfigJoystick (SDL_sysjoystick.c:555)
==544980==    by 0x492A5B7: SDL_SYS_JoystickOpen (SDL_sysjoystick.c:616)
==544980==    by 0x48A0446: SDL_JoystickOpen_REAL (SDL_joystick.c:133)
==544980==    by 0x402987: sim (investickgator.c:306)
==544980==    by 0x4026E0: main (investickgator.c:458)

stolk commented

This is probably a SDL 2.0.4 bug.

After upgrade to SDL 2.0.14, valgrind does not trigger on SDL, nor does it segfault.