When editing a file in vi-input, attempting to go to a specific line crashes Kate (or KDevelop). Reproducible: Always Steps to Reproduce: 1. Enter vi-input mode. 2. Type :42g (or a line number of your choice). 3. Hit 'enter'. Actual Results: Kate segfaults. Expected Results: Cursor moved to specified line. Backtrace. I don't have debug symbols enabled currently, might recompile later. Thread 1 "kate" received signal SIGSEGV, Segmentation fault. 0x00007ffff79bf408 in KateVi::EmulatedCommandBar::executeCommand(QString const&) () from /usr/lib/libKF5TextEditor.so.5 #0 0x00007ffff79bf408 in KateVi::EmulatedCommandBar::executeCommand(QString const&) () from /usr/lib/libKF5TextEditor.so.5 No symbol table info available. #1 0x00007ffff79c4beb in KateVi::EmulatedCommandBar::handleKeyPress(QKeyEvent const*) () from /usr/lib/libKF5TextEditor.so.5 No symbol table info available. #2 0x00007ffff79ad7d9 in KateVi::InputModeManager::handleKeypress(QKeyEvent const*) () from /usr/lib/libKF5TextEditor.so.5 No symbol table info available. #3 0x00007ffff324ade4 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #4 0x00007ffff48c60fe in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 No symbol table info available. #5 0x00007ffff48cb6d4 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 No symbol table info available. #6 0x00007ffff324b03a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #7 0x00007ffff79add2d in KateVi::InputModeManager::feedKeyPresses(QString const&) const () from /usr/lib/libKF5TextEditor.so.5 No symbol table info available. #8 0x00007ffff79c704b in KateVi::KeyMapper::playBackRejectedKeys() () from /usr/lib/libKF5TextEditor.so.5 No symbol table info available. #9 0x00007ffff79c74e5 in KateVi::KeyMapper::handleKeypress(QChar) () from /usr/lib/libKF5TextEditor.so.5 No symbol table info available. #10 0x00007ffff79ad770 in KateVi::InputModeManager::handleKeypress(QKeyEvent const*) () from /usr/lib/libKF5TextEditor.so.5 No symbol table info available. #11 0x00007ffff324ade4 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #12 0x00007ffff48c60fe in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 No symbol table info available. #13 0x00007ffff48cb6d4 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 No symbol table info available. #14 0x00007ffff324b03a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #15 0x00007ffff49302f3 in ?? () from /usr/lib/libQt5Widgets.so.5 No symbol table info available. #16 0x00007ffff48c6124 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 No symbol table info available. #17 0x00007ffff48caf78 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 No symbol table info available. #18 0x00007ffff324b03a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #19 0x00007ffff411d1b8 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/libQt5Gui.so.5 No symbol table info available. #20 0x00007ffff41224c5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5 No symbol table info available. #21 0x00007ffff4100a1b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5 No symbol table info available. #22 0x00007fffe4e5c750 in ?? () from /usr/lib/libQt5XcbQpa.so.5 No symbol table info available. #23 0x00007fffee9d3d87 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 No symbol table info available. #24 0x00007fffee9d3fe0 in ?? () from /usr/lib/libglib-2.0.so.0 No symbol table info available. #25 0x00007fffee9d408c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 No symbol table info available. #26 0x00007ffff32a318f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #27 0x00007ffff324957a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #28 0x00007ffff32521fc in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5 No symbol table info available. #29 0x0000000000439fe0 in main () No symbol table info available.
Kate is 15.12.2, KTextEditor is 5.19.0. Latest version in the bugs.kde.org dropdown is '5.0.0', some newer options would be nice.
Moving, since this occurs with KWrite and KDevelop. KTextEditor compiled with debug symbols: [20:50][436][flh ~/]$ cat kate_out Thread 1 "kate" received signal SIGSEGV, Segmentation fault. 0x00007ffff799ec7b in KateVi::EmulatedCommandBar::executeCommand (this=this@entry=0xbad790, commandToExecute=...) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/emulatedcommandbar.cpp:1142 1142 if (range.isValid() && !p->supportsRange(cmd)) { #0 0x00007ffff799ec7b in KateVi::EmulatedCommandBar::executeCommand (this=this@entry=0xbad790, commandToExecute=...) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/emulatedcommandbar.cpp:1142 p = 0x0 ci = <optimized out> n = <optimized out> textlen = <optimized out> commandResponseMessage = {static null = {<No data fields>}, d = 0x7ffff32eba20 <QArrayData::shared_null>} cmd = {static null = {<No data fields>}, d = 0xe179e0} range = {m_start = {m_line = 0, m_column = 0}, m_end = {m_line = 0, m_column = 0}} #1 0x00007ffff79a1d98 in KateVi::EmulatedCommandBar::handleKeyPress (this=0xbad790, keyEvent=keyEvent@entry=0x7fffffffd100) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/emulatedcommandbar.cpp:1036 commandToExecute = {static null = {<No data fields>}, d = 0xe2df90} parsedSedExpression = {parsedSuccessfully = false, findBeginPos = 0, findEndPos = -225121536, replaceBeginPos = 32767, replaceEndPos = 64, delimiter = {ucs = 0}} commandResponseMessage = {static null = {<No data fields>}, d = 0x6} #2 0x00007ffff798d5fd in KateVi::InputModeManager::handleKeypress (this=0x14727d0, e=0x7fffffffd100) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/inputmodemanager.cpp:147 res = false keyIsPartOfMapping = false isSyntheticSearchCompletedKeyPress = false #3 0x00007ffff323ade4 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 #4 0x00007ffff48b60fe in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 #5 0x00007ffff48bb6d4 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 #6 0x00007ffff323b03a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 #7 0x00007ffff798da06 in QCoreApplication::sendEvent (event=0x7fffffffd100, receiver=<optimized out>) at /usr/include/qt/QtCore/qcoreapplication.h:227 No locals. #8 KateVi::InputModeManager::feedKeyPresses (this=0x14727d0, keyPresses=...) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/inputmodemanager.cpp:235 decoded = {static null = {<No data fields>}, d = 0x121e5a0} k = <incomplete type> destWidget = <optimized out> _container_ = {c = {static null = {<No data fields>}, d = 0x121d700}, i = 0x121d718, e = 0x121d71a, control = 1} key = <optimized out> mods = {i = 0} text = {static null = {<No data fields>}, d = 0x7ffff32eba20 <QArrayData::shared_null>} #9 0x00007ffff79a4314 in KateVi::KeyMapper::playBackRejectedKeys (this=this@entry=0xe31e80) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/keymapper.cpp:69 mappingKeys = {static null = {<No data fields>}, d = 0x121d700} #10 0x00007ffff79a470e in KateVi::KeyMapper::handleKeypress (this=0xe31e80, key=..., key@entry=...) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/keymapper.cpp:122 isPartialMapping = <optimized out> isFullMapping = <optimized out> #11 0x00007ffff798d590 in KateVi::InputModeManager::handleKeypress (this=0x14727d0, e=0x7fffffffda70) at /home/flh/ktexteditor/src/ktexteditor-5.19.0/src/vimode/inputmodemanager.cpp:133 key = {ucs = 57424} res = false keyIsPartOfMapping = false isSyntheticSearchCompletedKeyPress = false #12 0x00007ffff323ade4 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 #13 0x00007ffff48b60fe in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 #14 0x00007ffff48bb6d4 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 #15 0x00007ffff323b03a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 #16 0x00007ffff49202f3 in ?? () from /usr/lib/libQt5Widgets.so.5 #17 0x00007ffff48b6124 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 #18 0x00007ffff48baf78 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5 #19 0x00007ffff323b03a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 #20 0x00007ffff410d1b8 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/libQt5Gui.so.5 #21 0x00007ffff41124c5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5 #22 0x00007ffff40f0a1b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5 #23 0x00007fffe4e4c750 in ?? () from /usr/lib/libQt5XcbQpa.so.5 #24 0x00007fffee9c3d87 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #25 0x00007fffee9c3fe0 in ?? () from /usr/lib/libglib-2.0.so.0 #26 0x00007fffee9c408c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #27 0x00007ffff329318f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5 #28 0x00007ffff323957a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5 #29 0x00007ffff32421fc in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5 #30 0x0000000000439fe0 in main ()
This is caused by the command 'g' not actually existing; KTE crashes when given a range for a nonexistent command.
Git commit 691c0315868511edff8048081e6e8b85c6653816 by Christoph Cullmann. Committed on 26/05/2016 at 14:34. Pushed by cullmann into branch 'master'. vimode: Don't crash when given a range for a nonexistent command. Patch by Francis Herne. When entering a range for a nonexistent command ,p is dereferenced before the null check. Move that check to before p is used. Differential Revision: D1684 M +14 -14 src/vimode/emulatedcommandbar.cpp http://commits.kde.org/ktexteditor/691c0315868511edff8048081e6e8b85c6653816
Git commit 6571af1abf9da2cce4bdc8b20fdd4436d840d107 by Simon St James. Committed on 17/06/2016 at 08:14. Pushed by sstjames into branch 'master'. The original patch (691c0315868511edff8048081e6e8b85c6653816) from Francis Herne got lost in the merge of the emulated command bar refactoring: I'm re-instating it here, this time with a test. Original commit message: vimode: Don't crash when given a range for a nonexistent command. Patch by Francis Herne. When entering a range for a nonexistent command ,p is dereferenced before the null check. Move that check to before p is used. Differential Revision: D1684 M +3 -0 autotests/src/vimode/emulatedcommandbar.cpp M +14 -15 src/vimode/emulatedcommandbar/commandmode.cpp http://commits.kde.org/ktexteditor/6571af1abf9da2cce4bdc8b20fdd4436d840d107