Page MenuHome GnuPG

KMail: Fix crash when switching from signed / encrypted mails before verification is done
Closed, ResolvedPublic

Description

There is an open merge request for messagelib: https://invent.kde.org/pim/messagelib/-/merge_requests/100 which I would love to have fixed.
I am hitting this crash nearly daily. If you cannot reproduce this I can give you my pubring.kbx which is large enough to make this issue easily reproducible even on very fast computers.

@dvratil I am assigning this directly to you even though that is not the usual workflow.

Details

External Link
https://invent.kde.org/pim/messagelib/-/merge_requests/100
Version
At least 5.23.1 but I have it for a while now

Event Timeline

aheinecke created this task.

Absolutely, I'll prioritize looking at this.

I think I can easilly generate a large-enough keyring locally :-)

Fix merged to release/23.04 branch.

ebo moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jul 20 2023, 10:47 AM

Hi Dan,

the crash is back, both ingo and me are experiencing it on 23.08 with opensuse tumbleweed. Since reporting it with drkonqi somehow did not work for me here is a backtrace from a decrypt then switch, but I can very reliably reproduce this:

Application: Kontact (kontact), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f7ca116c22d in __strlen_avx2 () at /lib64/libc.so.6
#5  0x00007f7c10f0e60b in QString::fromLocal8Bit(char const*, int) (size=-1, str=0x74656e2e786d <error: Cannot access memory at address 0x74656e2e786d>) at /usr/include/qt5/QtCore/qstring.h:708
#6  MimeTreeParser::EncryptedMessagePart::okDecryptMIME(KMime::Content&) (this=this@entry=0x561d41b76b30, data=...) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/messagepart.cpp:1229
#7  0x00007f7c10f0edf3 in MimeTreeParser::EncryptedMessagePart::startDecryption(KMime::Content*) (this=0x561d41b76b30, data=0x561d476b7390) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/messagepart.cpp:1285
#8  0x00007f7c10ef0feb in MimeTreeParser::MultiPartEncryptedBodyPartFormatter::process(MimeTreeParser::Interface::BodyPart&) const (this=<optimized out>, part=...) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/bodyformatter/multipartencrypted.cpp:80
#9  0x00007f7c10f039ae in MimeTreeParser::ObjectTreeParser::processType(KMime::Content*, MimeTreeParser::ProcessResult&, QByteArray const&) (this=this@entry=0x7fff2ae9c490, node=node@entry=0x561d405b9ff0, processResult=..., mimeType=...) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/objecttreeparser.cpp:146
#10 0x00007f7c10f03d5e in MimeTreeParser::ObjectTreeParser::parseObjectTreeInternal(KMime::Content*, bool) (this=this@entry=0x7fff2ae9c490, node=<optimized out>, onlyOneMimePart=<optimized out>) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/objecttreeparser.cpp:213
#11 0x00007f7c10f03f8b in MimeTreeParser::ObjectTreeParser::parseObjectTree(KMime::Content*, bool) (this=0x7fff2ae9c490, node=<optimized out>, parseOnlySingleNode=<optimized out>) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/objecttreeparser.cpp:116
#12 0x00007f7c11040c08 in MessageViewer::ViewerPrivate::parseContent(KMime::Content*) (this=0x561d401fc680, content=0x561d405b9ff0) at /usr/src/debug/messagelib-23.08.0/messageviewer/src/viewer/viewer_p.cpp:856
#13 0x00007f7c1104cf11 in MessageViewer::ViewerPrivate::displayMessage() (this=0x561d401fc680) at /usr/include/qt5/QtCore/qsharedpointer_impl.h:307
#14 MessageViewer::ViewerPrivate::updateReaderWin() (this=0x561d401fc680) at /usr/src/debug/messagelib-23.08.0/messageviewer/src/viewer/viewer_p.cpp:2138
#15 0x00007f7ca1b25812 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7fff2ae9c6e0, r=0x561d401fc680, this=0x561d40b05390) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#16 doActivate<false>(QObject*, int, void**) (sender=0x561d408b1540, signal_index=3, argv=0x7fff2ae9c6e0) at kernel/qobject.cpp:3925
#17 0x00007f7ca1b1e47f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f7c10f1d900 <MimeTreeParser::NodeHelper::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fff2ae9c6e0) at kernel/qobject.cpp:3985
#18 0x00007f7c10ee8a8e in MimeTreeParser::NodeHelper::update(MimeTreeParser::UpdateMode) (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/messagelib-23.08.0/build/mimetreeparser/src/KPim5MimeTreeParser_autogen/EWIEGA46WW/moc_nodehelper.cpp:133
#19 0x00007f7ca1b25812 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7fff2ae9c7f0, r=0x561d408b1540, this=0x561d47b4dc50) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#20 doActivate<false>(QObject*, int, void**) (sender=0x561d47b4cd20, signal_index=3, argv=0x7fff2ae9c7f0) at kernel/qobject.cpp:3925
#21 0x00007f7ca1b1e47f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x561d47b4cd20, m=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fff2ae9c7f0) at kernel/qobject.cpp:3985
#22 0x00007f7c10f0b205 in MimeTreeParser::CryptoBodyPartMemento::update(MimeTreeParser::UpdateMode) (_t1=<optimized out>, this=0x561d47b4cd20) at /usr/src/debug/messagelib-23.08.0/build/mimetreeparser/src/KPim5MimeTreeParser_autogen/YHS7SJUNTZ/moc_cryptobodypartmemento.cpp:144
#23 MimeTreeParser::CryptoBodyPartMemento::notify() (this=0x561d47b4cd20) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/memento/cryptobodypartmemento.h:48
#24 MimeTreeParser::DecryptVerifyBodyPartMemento::slotResult(GpgME::DecryptionResult const&, GpgME::VerificationResult const&, QByteArray const&) (this=0x561d47b4cd20, dr=<optimized out>, vr=<optimized out>, plainText=<optimized out>) at /usr/src/debug/messagelib-23.08.0/mimetreeparser/src/memento/decryptverifybodypartmemento.cpp:67
#25 0x00007f7ca1b25812 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7fff2ae9c8f0, r=0x561d47b4cd20, this=0x561d47b328e0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#26 doActivate<false>(QObject*, int, void**) (sender=0x7f7bf407b5f0, signal_index=7, argv=0x7fff2ae9c8f0) at kernel/qobject.cpp:3925
#27 0x00007f7ca1b1e47f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f7c116f3a60 <QGpgME::DecryptVerifyJob::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fff2ae9c8f0) at kernel/qobject.cpp:3985
#28 0x00007f7c116582a6 in QGpgME::DecryptVerifyJob::result(GpgME::DecryptionResult const&, GpgME::VerificationResult const&, QByteArray const&, QString const&, GpgME::Error const&) (this=<optimized out>, _t1=<optimized out>, _t2=<optimized out>, _t3=<optimized out>, _t4=<optimized out>, _t5=<optimized out>) at /usr/src/debug/gpgme-1.22.0/lang/qt/src/decryptverifyjob.moc:149
#29 0x00007f7c116713f9 in QGpgME::_detail::ThreadedJobMixin<QGpgME::DecryptVerifyJob, std::tuple<GpgME::DecryptionResult, GpgME::VerificationResult, QByteArray, QString, GpgME::Error> >::doEmitResult<GpgME::DecryptionResult, GpgME::VerificationResult, QByteArray, QString, GpgME::Error>(std::tuple<GpgME::DecryptionResult, GpgME::VerificationResult, QByteArray, QString, GpgME::Error> const&) (tuple=std::tuple containing = {...}, this=0x7f7bf407b5f0) at /usr/include/c++/13/tuple:237
#30 QGpgME::_detail::ThreadedJobMixin<QGpgME::DecryptVerifyJob, std::tuple<GpgME::DecryptionResult, GpgME::VerificationResult, QByteArray, QString, GpgME::Error> >::slotFinished() (this=0x7f7bf407b5f0) at /usr/src/debug/gpgme-1.22.0/lang/qt/src/threadedjobmixin.h:239
#31 0x00007f7ca1b19320 in QObject::event(QEvent*) (this=0x7f7bf407b5f0, e=0x7f7b90001490) at kernel/qobject.cpp:1347
#32 0x00007f7ca27a519e in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x7f7bf407b5f0, e=0x7f7b90001490) at kernel/qapplication.cpp:3640
#33 0x00007f7ca1aed568 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x7f7bf407b5f0, event=0x7f7b90001490) at kernel/qcoreapplication.cpp:1064
#34 0x00007f7ca1aed72e in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#35 0x00007f7ca1af0b61 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x561d40135cd0) at kernel/qcoreapplication.cpp:1821
#36 0x00007f7ca1af10a8 in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=<optimized out>, event_type=<optimized out>) at kernel/qcoreapplication.cpp:1680
#37 0x00007f7ca1b46c93 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x561d401659c0) at kernel/qeventdispatcher_glib.cpp:277
#38 0x00007f7c983169d8 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#39 0x00007f7c98316de8 in  () at /lib64/libglib-2.0.so.0
#40 0x00007f7c98316e7c in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#41 0x00007f7ca1b464a6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x561d40104500, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#42 0x00007f7ca1aebffb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fff2ae9cdf0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#43 0x00007f7ca1af4490 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#44 0x0000561d3f063fd3 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kontact-23.08.0/src/main.cpp:216
[Inferior 1 (process 17097) detached]
aheinecke moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Sep 14 2023, 8:56 AM
dvratil moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Sep 14 2023, 2:04 PM

OK, so after debugging the issue and finally digging into the code I realized that I don't see the fix I did the first time....it turned out I committed the fix to release/23.04 branch but forgot to merge it into master and as such the change did not make it to 23.08 - which is probably why it seemingly "came back" after you upgraded. I've cherry-picked the fix to release/23.08 branch and merged it to master.

Sorry about this.

Since 23.08.2 the crash is gone again as expected. Thanks. Btw. do you know which was the first version that had this crash? I am a bit worried that our fellow debian stable users in the office might be affected with the next debian upgrade. Since we use signed / encrypted mails a lot. :)