Bug 277385

Summary: Kate crashes using Insert Artistic Comment with an empty selection
Product: [Applications] kate Reporter: Burkhard Lück <lueck>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: devel
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Burkhard Lück 2011-07-08 20:26:10 UTC
Application: kate (3.7.40)
KDE Platform Version: 4.7.40 (4.7.40 (KDE 4.8 >= 200110623) (Compiled from sources)
Qt Version: 4.7.0
Operating System: Linux 2.6.35-28-generic x86_64
Distribution: Ubuntu 10.10

-- Information about the crash:
- What I was doing when the application crashed:

Start Kate - New empty file, nothing selected, then select 
Tools -> Insert Artistic Comment -> any menuitem
-> crash with master and 4.7 compiled from sources

The crash can be reproduced every time.

-- Backtrace:
Application: xxKatexx (kate), signal: Aborted
[Current thread is 1 (Thread 0x7f5b493b5760 (LWP 5022))]

Thread 2 (Thread 0x7f5b34ba4700 (LWP 5024)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f5b37356a93 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x7f5b376ec520) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#2  0x00007f5b373560ce in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=0x7f5b376ec520) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#3  0x00007f5b44d33971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#4  0x00007f5b442f092d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f5b493b5760 (LWP 5022)):
[KCrash Handler]
#6  0x00007f5b4423dba5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00007f5b442416b0 in abort () at abort.c:92
#8  0x00007f5b44fd40fd in qt_message_output (msgType=QtFatalMsg, buf=0x1bd8f78 "ASSERT: \"i >= 0\" in file /home/kdedev/qt-copy/include/QtCore/qstring.h, line 887") at global/qglobal.cpp:2259
#9  0x00007f5b44fd42fc in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7f5b451a3e58 "ASSERT: \"%s\" in file %s, line %d", ap=0x7fff4321bd20) at global/qglobal.cpp:2305
#10 0x00007f5b44fd4b68 in qFatal (msg=0x7f5b451a3e58 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2488
#11 0x00007f5b44fd3c63 in qt_assert (assertion=0x7f5b3607a45d "i >= 0", file=0x7f5b3607a420 "/home/kdedev/qt-copy/include/QtCore/qstring.h", line=887) at global/qglobal.cpp:2004
#12 0x00007f5b36072b4b in QString::operator[](int) () from /home/kdedev/kdedev/lib/kde4/ktexteditor_acomment.so
#13 0x00007f5b36075c5e in explode(QString, unsigned long) () from /home/kdedev/kdedev/lib/kde4/ktexteditor_acomment.so
#14 0x00007f5b3607655b in ArtisticComment::apply(QString const&) () from /home/kdedev/kdedev/lib/kde4/ktexteditor_acomment.so
#15 0x00007f5b36077c4b in ArtisticComment::decorate(QString const&, QString const&) () from /home/kdedev/kdedev/lib/kde4/ktexteditor_acomment.so
#16 0x00007f5b36071dbc in ACommentView::insertAComment(QAction*) () from /home/kdedev/kdedev/lib/kde4/ktexteditor_acomment.so
#17 0x00007f5b36072878 in ACommentView::qt_metacall(QMetaObject::Call, int, void**) () from /home/kdedev/kdedev/lib/kde4/ktexteditor_acomment.so
#18 0x00007f5b4511d4f9 in QMetaObject::metacall (object=0x1a32d10, cl=QMetaObject::InvokeMetaMethod, idx=4, argv=0x7fff4321c440) at kernel/qmetaobject.cpp:237
#19 0x00007f5b451347f7 in QMetaObject::activate (sender=0x1a39fa0, m=0x7f5b47276680, local_signal_index=2, argv=0x7fff4321c440) at kernel/qobject.cpp:3280
#20 0x00007f5b46a62ec1 in QMenu::triggered (this=0x1a39fa0, _t1=0x1a3adf0) at .moc/debug-shared/moc_qmenu.cpp:164
#21 0x00007f5b46a5a2a0 in QMenuPrivate::_q_actionTriggered (this=0x1a3a000) at widgets/qmenu.cpp:1111
#22 0x00007f5b46a62bd7 in QMenu::qt_metacall (this=0x1a39fa0, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7fff4321c6a0) at .moc/debug-shared/moc_qmenu.cpp:105
#23 0x00007f5b476529ed in KMenu::qt_metacall(QMetaObject::Call, int, void**) () from /home/kdedev/kdedev/lib/libkdeui.so.5
#24 0x00007f5b4511d4f9 in QMetaObject::metacall (object=0x1a39fa0, cl=QMetaObject::InvokeMetaMethod, idx=35, argv=0x7fff4321c6a0) at kernel/qmetaobject.cpp:237
#25 0x00007f5b451347f7 in QMetaObject::activate (sender=0x1a3adf0, m=0x7f5b47268400, local_signal_index=1, argv=0x7fff4321c6a0) at kernel/qobject.cpp:3280
#26 0x00007f5b464777c0 in QAction::triggered (this=0x1a3adf0, _t1=false) at .moc/debug-shared/moc_qaction.cpp:263
#27 0x00007f5b46476a02 in QAction::activate (this=0x1a3adf0, event=QAction::Trigger) at kernel/qaction.cpp:1256
#28 0x00007f5b46a59c60 in QMenuPrivate::activateCausedStack (this=0x1a3a000, causedStack=..., action=0x1a3adf0, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:993
#29 0x00007f5b46a5a148 in QMenuPrivate::activateAction (this=0x1a3a000, action=0x1a3adf0, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:1085
#30 0x00007f5b46a5e996 in QMenu::mouseReleaseEvent (this=0x1a39fa0, e=0x7fff4321d540) at widgets/qmenu.cpp:2301
#31 0x00007f5b4765203c in KMenu::mouseReleaseEvent(QMouseEvent*) () from /home/kdedev/kdedev/lib/libkdeui.so.5
#32 0x00007f5b464ff56b in QWidget::event (this=0x1a39fa0, event=0x7fff4321d540) at kernel/qwidget.cpp:8187
#33 0x00007f5b46a5f0c8 in QMenu::event (this=0x1a39fa0, e=0x7fff4321d540) at widgets/qmenu.cpp:2410
#34 0x00007f5b464898e6 in QApplicationPrivate::notify_helper (this=0x1180430, receiver=0x1a39fa0, e=0x7fff4321d540) at kernel/qapplication.cpp:4397
#35 0x00007f5b4648777e in QApplication::notify (this=0x7fff4321e440, receiver=0x1a39fa0, e=0x7fff4321d540) at kernel/qapplication.cpp:3960
#36 0x00007f5b4754a6bd in KApplication::notify(QObject*, QEvent*) () from /home/kdedev/kdedev/lib/libkdeui.so.5
#37 0x00007f5b45114b16 in QCoreApplication::notifyInternal (this=0x7fff4321e440, receiver=0x1a39fa0, event=0x7fff4321d540) at kernel/qcoreapplication.cpp:732
#38 0x00007f5b4648c08f in QCoreApplication::sendSpontaneousEvent (receiver=0x1a39fa0, event=0x7fff4321d540) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#39 0x00007f5b46485c4e in QApplicationPrivate::sendMouseEvent (receiver=0x1a39fa0, event=0x7fff4321d540, alienWidget=0x0, nativeWidget=0x1a39fa0, buttonDown=0x7f5b472aee48, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3057
#40 0x00007f5b4653be95 in QETWidget::translateMouseEvent (this=0x1a39fa0, event=0x7fff4321dfb0) at kernel/qapplication_x11.cpp:4337
#41 0x00007f5b46538939 in QApplication::x11ProcessEvent (this=0x7fff4321e440, event=0x7fff4321dfb0) at kernel/qapplication_x11.cpp:3414
#42 0x00007f5b465768f9 in x11EventSourceDispatch (s=0x117edb0, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#43 0x00007f5b3fc42342 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#44 0x00007f5b3fc462a8 in ?? () from /lib/libglib-2.0.so.0
#45 0x00007f5b3fc4645c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#46 0x00007f5b45153f53 in QEventDispatcherGlib::processEvents (this=0x1150cd0, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#47 0x00007f5b46577020 in QGuiEventDispatcherGlib::processEvents (this=0x1150cd0, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#48 0x00007f5b45111b38 in QEventLoop::processEvents (this=0x7fff4321e380, flags=...) at kernel/qeventloop.cpp:149
#49 0x00007f5b45111c8e in QEventLoop::exec (this=0x7fff4321e380, flags=...) at kernel/qeventloop.cpp:201
#50 0x00007f5b45115212 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
#51 0x00007f5b46486974 in QApplication::exec () at kernel/qapplication.cpp:3673
#52 0x00007f5b48fe2418 in kdemain () from /home/kdedev/kdedev/lib/libkdeinit4_kate.so
#53 0x0000000000400896 in main ()

Reported using DrKonqi
Comment 1 Jonathan 2011-07-08 21:28:20 UTC
I cannot reproduce that, could you recompile kte_acomment in Debug mode and post backtrace with line numbers?
Comment 2 Dominik Haumann 2011-07-08 22:09:34 UTC
Git commit a5a57375ddd382823d1ae52cd722fbd1dac426c0 by Dominik Haumann.
Committed on 09/07/2011 at 00:07.
Pushed by dhaumann into branch 'master'.

fix crash due to out-of-range index access

BUG: 277385

M  +3    -1    playground/kte_acomment/artisticcomment.cpp     

http://commits.kde.org/kate/a5a57375ddd382823d1ae52cd722fbd1dac426c0
Comment 3 Dominik Haumann 2011-07-08 22:11:21 UTC
Git commit c9f7f5d805a63a6b45acd882c38d83309126a411 by Dominik Haumann.
Committed on 09/07/2011 at 00:07.
Pushed by dhaumann into branch 'KDE/4.7'.

fix crash due to out-of-range index access

BUG: 277385

M  +3    -1    playground/kte_acomment/artisticcomment.cpp     

http://commits.kde.org/kate/c9f7f5d805a63a6b45acd882c38d83309126a411