jtgans / g13gui

A user-space driver and GUI configurator for the Logitech G13
MIT License
18 stars 1 forks source link

g13d crashes when it encounters the "dump" command #2

Closed jtgans closed 3 years ago

jtgans commented 3 years ago

g13d segfaults with a hard crash when it encounters a bare "dump" command in its input fifo. Seems to be some kind of bad string manipulation error:

[g13] omoikane:~/Projects/g13/build/g13d$ gdb --args ./g13d --pipe_in /run/g13d/in --pipe_out /run/g13d/out
GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./g13d...
(gdb) run
Starting program: /home/jtgans/Projects/g13/build/g13d/g13d --pipe_in /run/g13d/in --pipe_out /run/g13d/out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[2021-04-28 23:33:58.065597] [0x00007ffff7809b80] [info]    set log level to info
[2021-04-28 23:33:58.065685] [0x00007ffff7809b80] [info]    set_string_config_value pipe_in = "/run/g13d/in"
[2021-04-28 23:33:58.065700] [0x00007ffff7809b80] [info]    set_string_config_value pipe_out = "/run/g13d/out"
[2021-04-28 23:33:58.065966] [0x00007ffff7809b80] [info]    Known keys on G13:
[2021-04-28 23:33:58.065984] [0x00007ffff7809b80] [info]    BD DOWN G1 G10 G11 G12 G13 G14 G15 G16 G17 G18 G19 G2 G20 G21 G22 G3 G4 G5 G6 G7 G8 G9 L1 L2 L3 L4 LEFT LIGHT LIGHT2 LIGHT_STATE M1 M2 M3 MISC_TOGGLE MR TOP UNDEF1 UNDEF3
[2021-04-28 23:33:58.065990] [0x00007ffff7809b80] [info]    Known keys to map to:
[2021-04-28 23:33:58.066022] [0x00007ffff7809b80] [info]    0 1 2 3 4 5 6 7 8 9 A APOSTROPHE B BACKSLASH BACKSPACE C CAPSLOCK COMMA D DELETE DOT DOWN E END ENTER EQUAL ESC F F1 F10 F11 F12 F2 F3 F4 F5 F6 F7 F8 F9 G GRAVE H HOME I INSERT J K KP0 KP1 KP2 KP3 KP4 KP5 KP6 KP7 KP8 KP9 KPASTERISK KPDOT KPMINUS KPPLUS L LEFT LEFTALT LEFTBRACE LEFTCTRL LEFTSHIFT M MINUS N NUMLOCK O P PAGEDOWN PAGEUP Q R RIGHT RIGHTALT RIGHTBRACE RIGHTCTRL RIGHTSHIFT S SCROLLLOCK SEMICOLON SLASH SPACE T TAB U UP V W X Y Z
[New Thread 0x7ffff7803700 (LWP 9989)]
[2021-04-28 23:33:58.080313] [0x00007ffff7809b80] [info]    Found 1 G13s
[2021-04-28 23:33:58.115525] [0x00007ffff7809b80] [info]    Active Stick zones 
               STICK_UP   { 0 x 0.1 / 1 x 0.3 }   SEND KEYS: UP
             STICK_DOWN   { 0 x 0.7 / 1 x 0.9 }   SEND KEYS: DOWN
             STICK_LEFT   { 0 x 0 / 0.2 x 1 }   SEND KEYS: LEFT
            STICK_RIGHT   { 0.8 x 0 / 1 x 1 }   SEND KEYS: RIGHT
           STICK_PAGEUP   { 0 x 0 / 1 x 0.1 }   SEND KEYS: PAGEUP
         STICK_PAGEDOWN   { 0 x 0.9 / 1 x 1 }   SEND KEYS: PAGEDOWN
[2021-04-28 23:34:02.719611] [0x00007ffff7809b80] [info]    command: dump

Thread 1 "g13d" received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
65  ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
jtgans commented 3 years ago

Forgot the backtrace:

(gdb) bt
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
#1  0x00007ffff7d30009 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00005555555768a3 in G13::advance_ws (source=@0x7fffffefcf00: 0x0, dest="")
    at /home/jtgans/Projects/g13/g13d/device.cc:371
#3  0x00005555555715e3 in G13::Device::<lambda(char const*)>::operator()(const char *) const (
    __closure=0x7fffffefd090, remainder=0x0) at /home/jtgans/Projects/g13/g13d/device.cc:526
#4  0x0000555555574750 in std::_Function_handler<void(char const*), G13::Device::_init_commands()::<lambda(char const*)> >::_M_invoke(const std::_Any_data &, const char *&&) (__functor=..., __args#0=@0x7fffffefcfd0: 0x0)
    at /usr/include/c++/9/bits/std_function.h:300
#5  0x0000555555577d0d in std::function<void (char const*)>::operator()(char const*) const (this=0x7fffffefd090, 
    __args#0=0x0) at /usr/include/c++/9/bits/std_function.h:688
#6  0x00005555555723ca in G13::Device::command (this=0x555555623760, str=0x5555555ea720 "dump")
    at /home/jtgans/Projects/g13/g13d/device.cc:567
#7  0x000055555556ed59 in G13::Device::read_commands (this=0x555555623760)
    at /home/jtgans/Projects/g13/g13d/device.cc:278
#8  0x0000555555591ef0 in G13::Manager::run (this=0x7fffffffd690) at /home/jtgans/Projects/g13/g13d/manager.cc:194
#9  0x0000555555586612 in main (argc=5, argv=0x7fffffffd8d8) at /home/jtgans/Projects/g13/g13d/main.cc:62
jtgans commented 3 years ago

g13d isn't even in the codebase anymore. :D