Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-118150

Sporadic Crash in QXkbCommon::lookupLatinKeysym, when Events with Control-Modifiers are sent

    XMLWordPrintable

Details

    • Linux/Wayland
    • 689957dec (tqtc/lts-5.15)

    Description

      In our application we use a custom VNC server (libvncserver) and send generated key-events via qApp->postEvent().

      In some cases we see a crash, when a key with modifier "Control" was pressed.
      This was seen in Qt 5.15.13,  but the source qxkbcommon.cpp seems to be similar in Qt6.

      xkb_state_get_keymap in this callstack is called with state = nullptr, leading to SEGV

      (as a simple solution, state should be checked to be != nullptr, before calling this, 

      in qxkbcommon.cpp  Line 757 and probably also L 522)

       

      Callstack for Qt 5.15.13:

      Thread 1 "addressbook" received signal SIGSEGV, Segmentation fault.
      
      0x00007fd470b8d0d4 in xkb_state_get_keymap () from /lib/x86_64-linux-gnu/libxkbcommon.so.0
      
      (gdb) bt
      
      #0  0x00007fd470b8d0d4 in xkb_state_get_keymap () from /lib/x86_64-linux-gnu/libxkbcommon.so.0
      
      #1  0x00007fd46e7645a0 in QXkbCommon::lookupLatinKeysym (state=0x0, keycode=0) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp:757
      
      #2  0x00007fd46e763725 in QXkbCommon::keysymToQtKey (keysym=16777315, modifiers=..., state=0x0, code=0, superAsMeta=false, hyperAsMeta=false) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp:527
      
      #3  0x00007fd46e7636a1 in QXkbCommon::keysymToQtKey (keysym=16777315, modifiers=...) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp:507
      
      #4  0x00007fd46e6f29b8 in QtWaylandClient::QWaylandTextInput::zwp_text_input_v2_keysym (this=0x55ff3ed294b0, time=0, sym=16777315, state=1, modifiers=2) at /home/haufler/git/qt5.15.13/qt5/qtwayland/src/client/qwaylandinputcontext.cpp:340
      
      #5  0x00007fd46e70d617 in QtWayland::zwp_text_input_v2::handle_keysym (data=0x55ff3ed294b0, object=0x55ff3ed3eba0, time=0, sym=16777315, state=1, modifiers=2) at qwayland-text-input-unstable-v2.cpp:323
      
      #6  0x00007fd470b69e2e in ?? () from /lib/x86_64-linux-gnu/libffi.so.8
      
      #7  0x00007fd470b66493 in ?? () from /lib/x86_64-linux-gnu/libffi.so.8
      
      #8  0x00007fd471621ad0 in ?? () from /lib/x86_64-linux-gnu/libwayland-client.so.0
      
      #9  0x00007fd471622243 in ?? () from /lib/x86_64-linux-gnu/libwayland-client.so.0
      
      #10 0x00007fd47162243c in wl_display_dispatch_queue_pending () from /lib/x86_64-linux-gnu/libwayland-client.so.0
      
      #11 0x00007fd46e6cf946 in QtWaylandClient::QWaylandDisplay::flushRequests (this=0x55ff3ed2cf10) at /home/haufler/git/qt5.15.13/qt5/qtwayland/src/client/qwaylanddisplay.cpp:224
      
      #12 0x00007fd46e6d2302 in QtWaylandClient::QWaylandDisplay::qt_static_metacall (_o=0x55ff3ed2cf10, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7ffc44860860) at .moc/moc_qwaylanddisplay_p.cpp:77
      
      #13 0x00007fd4723c851a in doActivate<false> (sender=0x55ff3ed4e430, signal_index=3, argv=0x7ffc44860860) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/corelib/kernel/qobject.cpp:3937
      
      #14 0x00007fd4723c1273 in QMetaObject::activate (sender=0x55ff3ed4e430, m=0x7fd47279a3e0 <QSocketNotifier::staticMetaObject>, local_signal_index=0, argv=0x7ffc44860860) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/corelib/kernel/qobject.cpp:3985
      
      #15 0x00007fd4723d2c9e in QSocketNotifier::activated (this=0x55ff3ed4e430, _t1=..., _t2=QSocketNotifier::Read, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
      
      #16 0x00007fd4723d27ce in QSocketNotifier::event (this=0x55ff3ed4e430, e=0x7ffc44860de0) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/corelib/kernel/qsocketnotifier.cpp:302
      
      #17 0x00007fd472991821 in QApplicationPrivate::notify_helper (this=0x55ff3ed241e0, receiver=0x55ff3ed4e430, e=0x7ffc44860de0) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3652
      
      #18 0x00007fd47298e9d7 in QApplication::notify (this=0x7ffc44862770, receiver=0x55ff3ed4e430, e=0x7ffc44860de0) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2984
      
      #19 0x00007fd47236f457 in QCoreApplication::notifyInternal2 (receiver=0x55ff3ed4e430, event=0x7ffc44860de0) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1064
      
      #20 0x00007fd47236ff1c in QCoreApplication::sendEvent (receiver=0x55ff3ed4e430, event=0x7ffc44860de0) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1462
      
      #21 0x00007fd47240e129 in socketNotifierSourceDispatch (source=0x55ff3ed4e220) at /home/haufler/git/qt5.15.13/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:107
      
      #22 0x00007fd471b1bd3b in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            eckart1 Eckart Haufler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes