Bug 173964 - kmail crashes while parsing ~/.procmailrc
Summary: kmail crashes while parsing ~/.procmailrc
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.10.1
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2008-10-31 12:23 UTC by Alexander
Modified: 2008-11-30 16:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander 2008-10-31 12:23:12 UTC
Version:           1.10.1 (using KDE 4.1.2)
Compiler:          NA NA
OS:                Linux
Installed from:    Ubuntu Packages

Application crashed when I trying to add account of localmailbox type.

Приложение: Kontact (kontact), сигнал SIGABRT
(no debugging symbols found)
..........................
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xb4dee6c0 (LWP 8001)]
(no debugging symbols found)
.........................
(no debugging symbols found)
[KCrash handler]
#6  0xb80bb424 in __kernel_vsyscall ()
#7  0xb6c50880 in raise () from /lib/tls/i686/cmov/libc.so.6
#8  0xb6c52248 in abort () from /lib/tls/i686/cmov/libc.so.6
#9  0xb77c4795 in qt_message_output () from /usr/lib/libQtCore.so.4
#10 0xb77c4872 in qFatal () from /usr/lib/libQtCore.so.4
#11 0xb77c4915 in qt_assert () from /usr/lib/libQtCore.so.4
#12 0xb187fd88 in ?? () from /usr/lib/libkmailprivate.so.4
#13 0xb1883823 in ?? () from /usr/lib/libkmailprivate.so.4
#14 0xb188a1de in ?? () from /usr/lib/libkmailprivate.so.4
#15 0xb188bab0 in ?? () from /usr/lib/libkmailprivate.so.4
#16 0xb16464b6 in ?? () from /usr/lib/libkmailprivate.so.4
#17 0xb1683308 in ?? () from /usr/lib/libkmailprivate.so.4
#18 0xb78d1a60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#19 0xb78d1e60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#20 0xb759bde1 in QAbstractButton::clicked () from /usr/lib/libQtGui.so.4
#21 0xb72ef119 in ?? () from /usr/lib/libQtGui.so.4
#22 0xb72f0d14 in ?? () from /usr/lib/libQtGui.so.4
#23 0xb72f0fa6 in QAbstractButton::mouseReleaseEvent ()
   from /usr/lib/libQtGui.so.4
#24 0xb70059a2 in QWidget::event () from /usr/lib/libQtGui.so.4
#25 0xb72eefbe in QAbstractButton::event () from /usr/lib/libQtGui.so.4
#26 0xb7395890 in QPushButton::event () from /usr/lib/libQtGui.so.4
#27 0xb6fad8ec in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#28 0xb6fb6121 in QApplication::notify () from /usr/lib/libQtGui.so.4
#29 0xb7d8b72d in KApplication::notify () from /usr/lib/libkdeui.so.5
#30 0xb78bce61 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#31 0xb6fb53ae in QApplicationPrivate::sendMouseEvent ()
   from /usr/lib/libQtGui.so.4
#32 0xb701f696 in ?? () from /usr/lib/libQtGui.so.4
#33 0xb701ea25 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#34 0xb70487ea in ?? () from /usr/lib/libQtGui.so.4
#35 0xb56d96f8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#36 0xb56dcda3 in ?? () from /usr/lib/libglib-2.0.so.0
#37 0xb56dcf61 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#38 0xb78e7478 in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#39 0xb7047ee5 in ?? () from /usr/lib/libQtGui.so.4
#40 0xb78bb52a in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#41 0xb78bb6ea in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#42 0xb78bdda5 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#43 0xb6fad767 in QApplication::exec () from /usr/lib/libQtGui.so.4
#44 0x0804bf52 in _start ()
#0  0xb80bb424 in __kernel_vsyscall ()
Comment 1 George Goldberg 2008-11-11 15:37:17 UTC
Hi Alexander,

Thanks for reporting this bug. Is there any chance that you could install the debug packages for KMail (probably called kdepim-dbg) and then cause the crash again and copy the new backtrace to a comment on this bug report. Unfortunately the backtrace above is missing important lines from libkmailprivate.so debug symbols.
Comment 2 Alexander 2008-11-11 21:27:45 UTC
Ok. new bt. 
Приложение: KMail (kmail), сигнал SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0xb41166c0 (LWP 21045)]
[KCrash handler]
#6  0xb7f29424 in __kernel_vsyscall ()
#7  0xb6396880 in raise () from /lib/tls/i686/cmov/libc.so.6
#8  0xb6398248 in abort () from /lib/tls/i686/cmov/libc.so.6
#9  0xb6f19795 in qt_message_output () from /usr/lib/libQtCore.so.4
#10 0xb6f19872 in qFatal () from /usr/lib/libQtCore.so.4
#11 0xb6f19915 in qt_assert () from /usr/lib/libQtCore.so.4
#12 0xb7aa6d88 in KMail::ProcmailRCParser::processLocalLock (this=0xbfc29f74, 
    s=@0xbfc29ee0) at /usr/include/qt4/QtCore/qstring.h:830
#13 0xb7aaa823 in ProcmailRCParser (this=0xbfc29f74, filename=@0xbfc29f94)
    at /build/buildd/kdepim-4.1.2/kmail/accountdialog.cpp:161
#14 0xb7ab11de in KMail::AccountDialog::makeLocalAccountPage (this=0xbfc2a088)
    at /build/buildd/kdepim-4.1.2/kmail/accountdialog.cpp:342
#15 0xb7ab2ab0 in AccountDialog (this=0xbfc2a088, caption=@0xbfc2a424, 
    account=0xa6d2908, parent=0xa5206e8)
    at /build/buildd/kdepim-4.1.2/kmail/accountdialog.cpp:299
#16 0xb786d4b6 in AccountsPageReceivingTab::slotAddAccount (this=0xa5206e8)
    at /build/buildd/kdepim-4.1.2/kmail/configuredialog.cpp:989
#17 0xb78aa308 in AccountsPageReceivingTab::qt_metacall (this=0xa5206e8, 
    _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0xbfc2a55c)
    at /build/buildd/kdepim-4.1.2/obj-i486-linux-gnu/kmail/configuredialog_p.moc:554
#18 0xb7026a60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#19 0xb7026e60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#20 0xb6cf0de1 in QAbstractButton::clicked () from /usr/lib/libQtGui.so.4
#21 0xb6a44119 in ?? () from /usr/lib/libQtGui.so.4
#22 0xb6a45d14 in ?? () from /usr/lib/libQtGui.so.4
#23 0xb6a45fa6 in QAbstractButton::mouseReleaseEvent ()
   from /usr/lib/libQtGui.so.4
#24 0xb675a9a2 in QWidget::event () from /usr/lib/libQtGui.so.4
#25 0xb6a43fbe in QAbstractButton::event () from /usr/lib/libQtGui.so.4
#26 0xb6aea890 in QPushButton::event () from /usr/lib/libQtGui.so.4
#27 0xb67028ec in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#28 0xb670b121 in QApplication::notify () from /usr/lib/libQtGui.so.4
#29 0xb74e072d in KApplication::notify (this=0xbfc2b478, receiver=0xa523600, 
    event=0xbfc2ab38)
    at /build/buildd/kde4libs-4.1.2/kdeui/kernel/kapplication.cpp:311
#30 0xb7011e61 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#31 0xb670a3ae in QApplicationPrivate::sendMouseEvent ()
   from /usr/lib/libQtGui.so.4
#32 0xb6774696 in ?? () from /usr/lib/libQtGui.so.4
#33 0xb6773a25 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#34 0xb679d7ea in ?? () from /usr/lib/libQtGui.so.4
#35 0xb4a986f8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#36 0xb4a9bda3 in ?? () from /usr/lib/libglib-2.0.so.0
#37 0xb4a9bf61 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#38 0xb703c478 in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#39 0xb679cee5 in ?? () from /usr/lib/libQtGui.so.4
#40 0xb701052a in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#41 0xb70106ea in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#42 0xb7012da5 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#43 0xb6702767 in QApplication::exec () from /usr/lib/libQtGui.so.4
#44 0x0804a6c0 in main (argc=)
    at /build/buildd/kdepim-4.1.2/kmail/main.cpp:146
#0  0xb7f29424 in __kernel_vsyscall ()


(In reply to comment #1)
> Hi Alexander,
> 
> Thanks for reporting this bug. Is there any chance that you could install the
> debug packages for KMail (probably called kdepim-dbg) and then cause the crash
> again and copy the new backtrace to a comment on this bug report. Unfortunately
> the backtrace above is missing important lines from libkmailprivate.so debug
> symbols.
> 

Comment 3 George Kiagiadakis 2008-11-16 12:21:35 UTC
This crash is not related to the local mailbox, it is related to parsing your ~/.procmailrc file.
I can't reproduce myself, but l had a look at the code and it seems possible to have such a crash.

The backtrace says Q_ASSERT was called from:
#12 0xb7aa6d88 in KMail::ProcmailRCParser::processLocalLock (this=0xbfc29f74, 
    s=@0xbfc29ee0) at /usr/include/qt4/QtCore/qstring.h:830

and qstring.h:830 is in QString::operator[]. Having a look at this processLocalLock() function, it seems possible that it crashes in this code:

  // parse until we find the spoolfile
  QString line, prevLine;
  do {
    prevLine = line;
    line = mStream->readLine().trimmed();
  } while ( !mStream->atEnd() && (line[0] == '*' ||
                                prevLine[prevLine.length() - 1] == '\\' ));

note that prevLine[prevLine.length() - 1] could try to read prevLine[-1] if length() is 0 (i.e. the previous line is empty), and this assertion in QString::operator[] tries to ensure that the index is always >= 0

PS: possible temporary workaround: remove all empty lines from ~/.procmailrc :P
Comment 4 George Kiagiadakis 2008-11-16 12:40:51 UTC
if my theory is right, here is a possible fix:

Index: accountdialog.cpp
===================================================================
--- accountdialog.cpp   (revision 884939)
+++ accountdialog.cpp   (working copy)
@@ -218,7 +218,7 @@
     prevLine = line;
     line = mStream->readLine().trimmed();
   } while ( !mStream->atEnd() && (line[0] == '*' ||
-                                prevLine[prevLine.length() - 1] == '\\' ));
+               (prevLine.length() > 0 && prevLine[prevLine.length() - 1] == '\\') ));

   if( line[0] != '!' && line[0] != '|' &&  line[0] != '{' ) {
     // this is a filename, expand it


PS: it seems to me that this could crash only in the following case: have one line that starts with '*' and ends with '\', followed by an empty line, followed by a line that doesn't start with '*'. Is that the case Alexander?
Comment 5 Thomas McGuire 2008-11-18 15:26:57 UTC
SVN commit 886055 by tmcguire:

Fix possible crash when parsing the procmail file.
Patch by George Kiagiadakis <gkiagiad at csd dot uoc dot gr>,
thanks!

BUG: 173964


 M  +3 -2      accountdialog.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=886055
Comment 6 alan napier 2008-11-30 15:02:40 UTC
Kde crash handler output with debugging information added:
Application: KMail (kmail), signal SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0xb42816c0 (LWP 21751)]
[KCrash handler]
#6  0xb80aa430 in __kernel_vsyscall ()
#7  0xb6508880 in raise () from /lib/tls/i686/cmov/libc.so.6
#8  0xb650a248 in abort () from /lib/tls/i686/cmov/libc.so.6
#9  0xb654610d in ?? () from /lib/tls/i686/cmov/libc.so.6
#10 0xb654c3f4 in ?? () from /lib/tls/i686/cmov/libc.so.6
#11 0xb654f456 in ?? () from /lib/tls/i686/cmov/libc.so.6
#12 0xb6550865 in malloc () from /lib/tls/i686/cmov/libc.so.6
#13 0xb6705d47 in operator new () from /usr/lib/libstdc++.so.6
#14 0xb7ea306e in QDateTime::QDateTime () from /usr/lib/libQtCore.so.4
#15 0xb7f1a5e3 in ?? () from /usr/lib/libQtCore.so.4
#16 0xb7f1909e in ?? () from /usr/lib/libQtCore.so.4
#17 0xb7f19de1 in QFileInfo::QFileInfo () from /usr/lib/libQtCore.so.4
#18 0xb779d93e in KMFolderMaildir::getDwString (this=0x8d7ee30, idx=242)
    at /build/buildd/kdepim-4.1.3/kmail/kmfoldermaildir.cpp:547
#19 0xb7799bf6 in KMFolderMaildir::readMsg (this=0x8d7ee30, idx=242)
    at /build/buildd/kdepim-4.1.3/kmail/kmfoldermaildir.cpp:538
#20 0xb76b1fd5 in FolderStorage::getMsg (this=0x8d7ee30, idx=242)
    at /build/buildd/kdepim-4.1.3/kmail/folderstorage.cpp:487
#21 0xb768097b in KMFolder::getMsg (this=0x8d7ece0, idx=242)
    at /build/buildd/kdepim-4.1.3/kmail/kmfolder.cpp:345
#22 0xb76fdc35 in KMSearchPattern::matches (this=0x8d1bc48, serNum=10797, 
    ignoreBody=false)
    at /build/buildd/kdepim-4.1.3/kmail/kmsearchpattern.cpp:790
#23 0xb76aea48 in FolderStorage::search (this=0x8d7ee30, pattern=0x8d1bc48, 
    serNum=10797) at /build/buildd/kdepim-4.1.3/kmail/folderstorage.cpp:1176
#24 0xb78c0080 in KMFolderSearch::propagateHeaderChanged (this=0x8d70350, 
    aFolder=0x8d7ece0, idx=242)
    at /build/buildd/kdepim-4.1.3/kmail/kmfoldersearch.cpp:1174
#25 0xb78c19ed in KMFolderSearch::qt_metacall (this=0x8d70350, 
    _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0xbf8aa058)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/kmfoldersearch.moc:178
#26 0xb7f9aa60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#27 0xb7f9b7e2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#28 0xb76d84d9 in KMFolderMgr::msgHeaderChanged (this=0x8c4d1a0, 
    _t1=0x8d7ece0, _t2=242)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/kmfoldermgr.moc:161
#29 0xb76db44d in KMFolderMgr::qt_metacall (this=0x8c4d1a0, 
    _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0xbf8aa158)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/kmfoldermgr.moc:97
#30 0xb7f9aa60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#31 0xb7f9b7e2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#32 0xb7681569 in KMFolder::msgHeaderChanged (this=0x8d7ece0, _t1=0x8d7ece0, 
    _t2=242)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/kmfolder.moc:228
#33 0xb7681c85 in KMFolder::qt_metacall (this=0x8d7ece0, 
    _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbf8aa258)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/kmfolder.moc:119
#34 0xb7f9aa60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#35 0xb7f9b7e2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#36 0xb76ae4b9 in FolderStorage::msgHeaderChanged (this=0x8d7ee30, 
    _t1=0x8d7ece0, _t2=242)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/folderstorage.moc:255
#37 0xb7721090 in KMMsgBase::setStatus (this=0x932f750, aStatus=@0xbf8aa2f8, 
    idx=242) at /build/buildd/kdepim-4.1.3/kmail/kmmsgbase.cpp:205
#38 0xb76c46a6 in KMMsgInfo::setStatus (this=0x932f750, aStatus=@0xbf8aa2f8, 
    idx=-1) at /build/buildd/kdepim-4.1.3/kmail/kmmsginfo.cpp:692
#39 0xb76afe64 in FolderStorage::markNewAsUnread (this=0x8d7ee30)
    at /build/buildd/kdepim-4.1.3/kmail/folderstorage.cpp:170
#40 0xb7680e77 in KMFolder::markNewAsUnread (this=0x8d7ece0)
    at /build/buildd/kdepim-4.1.3/kmail/kmfolder.cpp:529
#41 0xb762c584 in KMHeaders::setFolder (this=0x8e0c868, aFolder=0x8d8ece0, 
    forceJumpToUnread=false)
    at /build/buildd/kdepim-4.1.3/kmail/kmheaders.cpp:707
#42 0xb78b3b01 in KMMainWidget::folderSelected (this=0x8e0fab8, 
    aFolder=0x8d8ece0, forceJumpToUnread=<value optimized out>)
    at /build/buildd/kdepim-4.1.3/kmail/kmmainwidget.cpp:2201
#43 0xb78b6049 in KMMainWidget::qt_metacall (this=0x8e0fab8, 
    _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0xbf8aa4fc)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/kmmainwidget.moc:324
#44 0xb7f9aa60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#45 0xb7f9b7e2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#46 0xb75fa003 in KMFolderTree::folderSelected (this=0x90e05c0, _t1=0x8d8ece0)
    at /build/buildd/kdepim-4.1.3/obj-i486-linux-gnu/kmail/kmfoldertree.moc:296
#47 0xb75fe864 in KMFolderTree::doFolderSelected (this=0x90e05c0, 
    qlvi=0x93855c0, keepSelection=true)
    at /build/buildd/kdepim-4.1.3/kmail/kmfoldertree.cpp:1018
#48 0xb75fea04 in KMFolderTree::contentsMouseReleaseEvent (this=0x90e05c0, 
    me=0xbf8aa5ac) at /build/buildd/kdepim-4.1.3/kmail/kmfoldertree.cpp:1199
#49 0xb57f8fa1 in Q3ScrollView::viewportMouseReleaseEvent ()
   from /usr/lib/libQt3Support.so.4
#50 0xb57fac20 in Q3ScrollView::eventFilter ()
   from /usr/lib/libQt3Support.so.4
#51 0xb5796616 in Q3ListView::eventFilter () from /usr/lib/libQt3Support.so.4
#52 0xb75fa9da in KMFolderTree::eventFilter (this=0x90e05c0, o=0x90e1408, 
    e=0xbf8aab58) at /build/buildd/kdepim-4.1.3/kmail/kmfoldertree.cpp:1815
#53 0xb7f8504a in QCoreApplicationPrivate::sendThroughObjectEventFilters ()
   from /usr/lib/libQtCore.so.4
#54 0xb68748ca in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#55 0xb687d0e1 in QApplication::notify () from /usr/lib/libQtGui.so.4
#56 0xb720bb2d in KApplication::notify (this=0xbf8ab498, receiver=0x90e1408, 
    event=0xbf8aab58)
    at /build/buildd/kde4libs-4.1.3/kdeui/kernel/kapplication.cpp:311
#57 0xb7f85e61 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#58 0xb687c36e in QApplicationPrivate::sendMouseEvent ()
   from /usr/lib/libQtGui.so.4
#59 0xb68e6656 in ?? () from /usr/lib/libQtGui.so.4
#60 0xb68e59e5 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#61 0xb690f7aa in ?? () from /usr/lib/libQtGui.so.4
#62 0xb643a6f8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#63 0xb643dda3 in ?? () from /usr/lib/libglib-2.0.so.0
#64 0xb643df61 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#65 0xb7fb0478 in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#66 0xb690eea5 in ?? () from /usr/lib/libQtGui.so.4
#67 0xb7f8452a in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#68 0xb7f846ea in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#69 0xb7f86da5 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#70 0xb6874767 in QApplication::exec () from /usr/lib/libQtGui.so.4
#71 0x0804a6c0 in main (argc=)
    at /build/buildd/kdepim-4.1.3/kmail/main.cpp:146
#0  0xb80aa430 in __kernel_vsyscall ()
Comment 7 Thomas McGuire 2008-11-30 16:31:39 UTC
SVN commit 890876 by tmcguire:

Backport r886055 by tmcguire from trunk to the 4.1 branch:

Fix possible crash when parsing the procmail file.
Patch by George Kiagiadakis <gkiagiad at csd dot uoc dot gr>,
thanks!

CCBUG: 173964



 M  +3 -2      accountdialog.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=890876