Bug 53185 - [PATCH] Crash when switching message while GPG passphrase entry dialog is shown
Summary: [PATCH] Crash when switching message while GPG passphrase entry dialog is shown
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: encryption (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: triaged
: 49625 61749 62031 73543 74921 146454 148693 149132 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-01-20 12:14 UTC by Melchior Franz
Modified: 2009-12-07 16:17 UTC (History)
15 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Small patch... (673 bytes, patch)
2007-08-23 19:46 UTC, Alexis Papadopoulos
Details
Patch correcting issue (686 bytes, patch)
2007-08-24 19:48 UTC, Alexis Papadopoulos
Details
kcrash file of the described SIGSEGV (47.22 KB, application/octet-stream)
2009-08-15 00:19 UTC, Florian E.J. Fruth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Melchior Franz 2003-01-20 12:14:15 UTC
Version:           1.5.9 (using KDE 3.1.9)
Compiler:          gcc version 3.2
OS:          Linux (i686) release 2.4.19

kmail (from CVS HEAD as of yesterday, 2003/01/19) reliably segfaults,
if you do this:

  - start kmail
  - go to a folder where you have an encrypted message next to an
    unencrypted
  - select the unencrypted message in the message list
  - now skip to the encrypted message and =immediately= back to the
    unencrypted using the keyboard (cursor left/right)
    [the password dialog for the encrypted message pops up]
  - cancel the dialog (or fill in the pwd and hit OK; doesn't matter)
  * watch kmail crash  :-]



#0  0x40f24cb9 in vtable for DwString () from /usr/local/kde/lib/libmimelib.so.1
#1  0x401d6aad in KMReaderWin::parseMsg(KMMessage*, bool) (this=0x81e18f0, aMsg=0x819efa8,
    onlyProcessHeaders=65) at kmreaderwin.cpp:1536
#2  0x401d4e04 in KMReaderWin::parseMsg() (this=0x81e18f0) at kmreaderwin.cpp:1381
#3  0x401d2705 in KMReaderWin::updateReaderWin() (this=0x81e18f0) at kmreaderwin.cpp:1147
#4  0x401eab54 in KMReaderWin::qt_invoke(int, QUObject*) (this=0x81e18f0, _id=47,
    _o=0xbfffeb70) at kmreaderwin.moc:290
#5  0x4141153c in QObject::activate_signal(QConnectionList*, QUObject*) (this=0x81e19d4,
    clist=0x81f7440, o=0xbfffeb70) at kernel/qobject.cpp:2212
#6  0x4141140f in QObject::activate_signal(int) (this=0x81e19d4, signal=2)
    at kernel/qobject.cpp:2186
#7  0x417122d4 in QTimer::timeout() (this=0x81e19d4) at .moc/debug-shared-mt/moc_qtimer.cpp:82
#8  0x41435109 in QTimer::event(QEvent*) (this=0x81e19d4, e=0xbfffedd0)
    at kernel/qtimer.cpp:219
#9  0x413ab1b8 in QApplication::internalNotify(QObject*, QEvent*) (this=0xbffff100,
    receiver=0x81e19d4, e=0xbfffedd0) at kernel/qapplication.cpp:2350
#10 0x413aa7d9 in QApplication::notify(QObject*, QEvent*) (this=0xbffff100,
    receiver=0x81e19d4, e=0xbfffedd0) at kernel/qapplication.cpp:2112
#11 0x40fac2f9 in KApplication::notify(QObject*, QEvent*) (this=0x84a1cf0, receiver=0x81e19d4,
    event=0xbfffedd0) at kapplication.cpp:454
#12 0x41350095 in QApplication::sendEvent(QObject*, QEvent*) (receiver=0x81e19d4,
    event=0xbfffedd0) at kernel/qapplication.h:478
#13 0x41384c4a in QEventLoop::activateTimers() (this=0x80ec498)
    at kernel/qeventloop_unix.cpp:524
#14 0x4135fb13 in QEventLoop::processEvents(unsigned) (this=0x80ec498, flags=4)
    at kernel/qeventloop_x11.cpp:311
#15 0x413c197a in QEventLoop::enterLoop() (this=0x80ec498) at kernel/qeventloop.cpp:191
#16 0x413c1896 in QEventLoop::exec() (this=0x80ec498) at kernel/qeventloop.cpp:138
#17 0x413ab33b in QApplication::exec() (this=0xbffff100) at kernel/qapplication.cpp:2471
#18 0x4029c76d in main (argc=139074800, argv=0x84a1cf0)
    at /usr/local/kde/include/kapplication.h:178
#19 0x41aaa4a2 in __libc_start_main () from /lib/libc.so.6
Comment 1 Till Adam 2003-06-30 09:12:52 UTC
Reproduceable here, and sursprisingly hard to fix, from a first stab. Maybe I'm thick, 
though, I'll look into it. 
Comment 2 Ingo Klöcker 2003-07-28 15:27:04 UTC
*** Bug 61749 has been marked as a duplicate of this bug. ***
Comment 3 Ingo Klöcker 2003-08-03 01:11:39 UTC
*** Bug 62031 has been marked as a duplicate of this bug. ***
Comment 4 Stephan Kulow 2003-09-20 10:02:48 UTC
*** Bug 49625 has been marked as a duplicate of this bug. ***
Comment 5 Carsten Burghardt 2003-11-26 20:18:40 UTC
Can you still reproduce this? I can't ...
Comment 6 Melchior Franz 2003-11-27 11:07:38 UTC
Subject: Re:  crash when password dialog exited and meanwhile different message selected

* Carsten Burghardt -- Wednesday 26 November 2003 20:18:
> Can you still reproduce this? I can't ...

Yes. Exactly the same (mis-)behavior in a fresh kmail
from yesterday evening (2003-11-26).

Comment 7 Ingo Klöcker 2004-01-26 16:54:57 UTC
*** Bug 73543 has been marked as a duplicate of this bug. ***
Comment 8 Ingo Klöcker 2004-02-11 11:35:47 UTC
*** Bug 74921 has been marked as a duplicate of this bug. ***
Comment 9 M.J.Harwood 2004-02-19 16:19:55 UTC
This still happens with kmail 1.6/kde 3.2 release. I run into this frequently as I tend to scroll through folder contents using the cursor keys and if I don't have kmail set to cache my pgp passphrase (which I'd rather not do), skipping past an encrypted mail will invariably crash kmail. If I can do anything to help fix this, let me know.
Comment 10 horst nagel 2004-04-20 16:12:58 UTC
The same effect can be reproduced in another way:

- put first an unencrypted and then an encrypted message into the outbox
- select the outbox
- select the unencrypted message in the message list
- press the sendbutton
- the unencrypted message is send
- kmail selects the encrypted message
- the passphrase dialog pops up
- cancel the dialog (or fill in the pwd and hit OK; doesn't matter)
- kmail crashs :(
(fortunately meanwhile the mail is send correctly, even if there are more messages they will be send, until you leave the dialog alone ...)
Comment 11 horst nagel 2004-11-04 23:37:00 UTC
I can't reproduce the bug with kmail 1.7 / kde 3.3.0
Comment 12 olistrut 2004-11-05 02:21:08 UTC
I used to have this problem with earlier versions of KMail, but works fine with 1.7.1
Comment 13 Tom Albers 2004-11-05 09:31:20 UTC
Cool!
Comment 14 Florian E.J. Fruth 2005-03-17 20:32:24 UTC
i can still reproduce this bug with kde 3.3.0/3.4.0 in a bit different way:

1. i select an encrypted message
2. the gpg-enter passphrase dialog appears
3. i click back to the kmail main window and select another message
4. i close the gpg-dialog
5. kmail crashes
Comment 15 Mark Draheim 2005-05-30 01:05:51 UTC
still present in kmail 1.8 on 3.4.0 and I regularly run into this error. 

To speculate in non-programmer's language, I'd say that kmail crashes because it doesn't know which message to display. The gpg dialog applies to a message that is no longer active. Cancelling the dialog should show the raw text of the encrypted message. However, that one is no longer selected/active. Selected is another message, be it encrypted or not doesn't matter.

So either prevent selection of a different message for as long as the gpg dialog is open or automatically cancel the gpg dialog as soon as a different message is selected. 



Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1246935360 (LWP 25779)]
[KCrash handler]
#7  0xb7ed1ee7 in partNode::processed (this=0x22222222) at partNode.h:231
#8  0xb7ead2c8 in KMReaderWin::parseMsg (this=0x824c6d8, aMsg=0x83e5430)
    at kmreaderwin.cpp:1425
#9  0xb7e0b9af in KMReaderWin::displayMessage (this=0x824c6d8)
    at kmreaderwin.cpp:1360
#10 0xb7e0bb67 in KMReaderWin::updateReaderWin (this=0x824c6d8)
    at kmreaderwin.cpp:1302
#11 0xb7ea096d in KMReaderWin::qt_invoke (this=0x824c6d8, _id=48, 
    _o=0xbfffef9c) at kmreaderwin.moc:273
#12 0xb741c21d in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#13 0xb719ccf0 in ?? () from /usr/lib/libstdc++.so.6
#14 0x084049c0 in ?? ()
#15 0xbfffef58 in ?? ()
#16 0xb71785d1 in operator delete () from /usr/lib/libstdc++.so.6

Comment 16 Julian Mehnle 2005-11-15 11:57:11 UTC
I am still experiencing this bug, too.  KMail 1.8.2, KDE 3.4.2, Debian/Etch.
Comment 17 Jürgen Starek 2006-12-03 18:58:11 UTC
I am *still* seeing this behaviour with KMail 1.9.5, KGPG 1.2.2, gpg 1.4.3, all standard Kubuntu 6.10 packages. Why was this bug marked closed?
Comment 18 MM 2007-05-15 11:20:59 UTC
Still here, with KDE 3.5.6, kmail 1.9.6. 
Please, reopen!
Comment 19 Bram Schoenmakers 2007-05-15 12:25:58 UTC
Reopening due to some "still can reproduce" reports.
Comment 20 Bram Schoenmakers 2007-06-06 19:15:58 UTC
*** Bug 146454 has been marked as a duplicate of this bug. ***
Comment 21 Thomas McGuire 2007-08-10 00:24:17 UTC
*** Bug 148693 has been marked as a duplicate of this bug. ***
Comment 22 Thomas McGuire 2007-08-23 16:58:52 UTC
*** Bug 149132 has been marked as a duplicate of this bug. ***
Comment 23 Alexis Papadopoulos 2007-08-23 19:46:19 UTC
Hi there,

I reported a similar issue, although from the looks of it, the problems might be slightly different from one another.

Anyway, for more details look at http://bugs.kde.org/show_bug.cgi?id=149132
aMsg is not valid any more once we come back from the object tree parsing, so I figured that adding a check to see if the current message is aMsg should do the trick there.

It fixed my problem, no more crashes, however I don't know if it might raise some other issues. Maybe some dev could tell us if this is too unorthodox or not. From the looks of it, the aMsg passed to KMReaderWin::parseMsg is initialized to KMReader::message within KMReader::displayMessage, no other call to parseMsg is made elsewhere in the code.

Therefore it seems rather safe to make the assumption that this patch should not introduce other problems, but I think that we'll need another opinion on this matter.

acp
Comment 24 Alexis Papadopoulos 2007-08-23 19:46:57 UTC
Created attachment 21468 [details]
Small patch...
Comment 25 Alexis Papadopoulos 2007-08-24 19:46:55 UTC
I'm sending an updated version of the patch, I realized that actually the reader window didn't show the newly selected message, so a call to displayMessage was needed.

Sorry for the messy first attempt.

Alexis
Comment 26 Alexis Papadopoulos 2007-08-24 19:48:24 UTC
Created attachment 21475 [details]
Patch correcting issue
Comment 27 Jürgen Starek 2008-05-14 13:19:48 UTC
Meanwhile, I can no longer reproduce this behaviour using KMail 1.9.9 under KDE 3.5.9 (taken from KDEMod, a KDE distribution for ArchLinux) *and* pinentry installed. After conversing with Daniel Hahler, it seems that installing pinentry fixes this problem.

Hence, wouldn't it be sufficient to apply the solution discussed under Bug 92619 (Possibility for KMail to view all encrypted emails if gpg-agent is not running)?
Comment 28 Alexis Papadopoulos 2008-05-14 17:58:37 UTC
Hi there,

it's been a while since I looked at KMail's code, but I don't think that the two bugs you mention are related. From what I recall, bug 92619 fixed the fact that no dialog was shown to enter a password to decrypt a message.

Here we get the dialog but if you select another mail and press OK (on the dialog) KMail crashes...
Comment 29 quazgar 2008-05-14 18:07:18 UTC
I don't know the internals, but it crashes with a passphrase somewhere in the memory.  To me that sounds like it should be treated seriously until someone can confirm that the passphrase is safe.
Comment 30 Justin Lindberg 2008-06-13 16:19:30 UTC
This bug apparently has not been fixed as of the following version (package installed from Ubuntu Hardy repository):

Qt: 3.3.8b
KDE: 3.5.9
KMail: 1.9.9

To reproduce this bug:

1. Visit a folder that contains some encrypted messages.
2. Click on an encrypted message (if one is not already selected).
   A dialog box entitled "OpenPGP Security Check - KMail" will appear
   asking, "Please enter your OpenPGP passphrase:"
3. Ignore this dialog box and select another message.
   At this point a warning will be issued to stderr:
     kmail: WARNING: The root node is not yet processed! Danger!
4. Now, no matter what you do with that dialog box, whether you enter
   a passphrase or not, whether you click OK or Cancel, KMail
   will crash:
     *** KMail got signal 11 (Crashing)
     KCrash: Application 'kmail' crashing...
Comment 31 Dominik Tritscher 2008-08-31 13:17:31 UTC
This seems to be fixed in KDE4.1
First of all, the password dialog is not shown by simply selecting an unencrypted mail, you have to klick a link-button within the mail. Additionally the password dialog is a modal popup, so it's not possible to do anything else in the kmail window.
I tried selecting another mail anyways and kmail doesn't crash when the password dialog disappears (either on cancel or entering password).
Comment 32 Jaime Torres 2008-09-12 16:15:43 UTC
It works for me also.
Comment 33 Alexis Papadopoulos 2009-08-14 23:41:10 UTC
Hi there,

I've tried it and I still get a crash on KDE 4.2.4 (debian packages), KMail 1.11.4.

@Dominik: If I'm not mistaken, whether the password dialog shows up automatically or nor is configurable (Settings > Configure KMail > Security > Attempt decryption of encrypted messages when viewing). [For some strange reason this setting is discarded for some mails and every time I click on them I get the dialog; might have something to do with how encryption was performed: inline, MIME, etc.]

Anyway, when the pinentry dialog pops up, I just come back to KMail and click on another mail or folder (anything that changes the currently displayed messages will probably do). Although nothing happens immediately (it's a modal window as you suggested), the click is registered and performed right after the pinentry dialog closes. If I press CANCEL on the pinentry dialog, KMail changes the active message and crashes right after.

I don't have broadband internet access to get the 4.3 packages from sid (although I doubt this was fixed in the meanwhile, given that this bug report was closed way back) and cannot check the source code, etc.

In the meantime, can someone else test this and if confirmed, please reopen the bug?
Comment 34 Melchior Franz 2009-08-14 23:55:15 UTC
WORKSFORME with SVN/HEAD ("4.4pre"). No crashes, no matter how brutal I was. Can't say anything about 4.3, but given that it was just released I assume it works there, too.
Comment 35 Alexis Papadopoulos 2009-08-14 23:57:43 UTC
Hello,

just in case, do you also get a pinentry dialog or is there also a kmail/kde specific one as fallback?

I'll try svn as soon as I get a decent internet connection...
Comment 36 Melchior Franz 2009-08-15 00:02:59 UTC
The window title says "pinentry-qt". Didn't see any other password input dialog.
Comment 37 Florian E.J. Fruth 2009-08-15 00:13:55 UTC
The problem still exists for kde-4.3.0-1 (Debian/SID/using pinentry-qt) - but in a different matter than it was in early stages. In early stages kmail crashed when selecting another folder while the pinentry dialog was still open. At the moment I can create a SIGSEGV in the following way:

1. select an encrypted email and wait till the pinentry dialog pops up
2. now the keyboard "doesn't work anymore" (read: I can enter my pin but I'm unable to use other keys like <Alt>+<Tab>, ...)
3. in this state use the mouse to click through the kmail folders (You don't see anything happen because kmail blocks while the pinentry dialog is still open!)
4. close the pinentry dialog (by entering your passphrase or clicking cancel)
5. now you can watch kmail processing the queued mouse-clicks (the ones from step 3). After some (or all?) of them are through I get the SIGSEGV again...

- Konsole output:
QGpgMEProgressTokenMapper::map( "-&30" 63 )
QGpgMEProgressTokenMapper::map( "-&30" 63 )
QPainter::begin: Widget painting can only begin as a result of a paintEvent
QPainter::translate: Painter not active
QPainter::setClipRect: Painter not active
*** KMail got signal 11 (Crashing)
KCrash: Application 'kmail' crashing...
sock_file=/home/fejf/.kde/socket-fejfs/kdeinit4__0

- kcrash -> attachment
Comment 38 Florian E.J. Fruth 2009-08-15 00:19:26 UTC
Created attachment 36162 [details]
kcrash file of the described SIGSEGV
Comment 39 Alexis Papadopoulos 2009-08-15 00:21:32 UTC
Yeap, that's exactly it; same thing here. I think the bug is the same, just the
way to trigger it has slightly changed from the fact that the dialog is now a
modal one...

Imho it should be reopened.
Comment 40 Alexis Papadopoulos 2009-09-22 13:56:58 UTC
Bug is still here, and the fix proposed (https://bugs.kde.org/attachment.cgi?id=21475) still works (tested on KDEPIM 4.3.1 [KMail 1.12.1]), although the line is not the same (the KMReaderWin::parseMsg function has not changed fundamentally though, therefore posting a new patch is imho useless).

Please reopen the bug, since it DOES NOT work for everyone (3, 4 cases reported on several different versions): try following the guidelines provided above by  Florian.
Comment 41 Alexis Papadopoulos 2009-09-22 13:59:45 UTC
I'm also copying the crash report (kmail was executed with --nofork to make the output more obvious):

Application: KMail (kmail), signal: Segmentation fault
[KCrash Handler]
#6  0xb65e3b41 in typeinfo for QGroupBox () from /usr/lib/libQtGui.so.4
#7  0x880804ce in ?? ()
#8  0xb7347aab in KMReaderWin::displayMessage (this=0x858a048) at /home/alex/kmail/kdepim-4.3.1/kmail/kmreaderwin.cpp:1605
#9  0xb7347cc0 in KMReaderWin::updateReaderWin (this=0x85168d0) at /home/alex/kmail/kdepim-4.3.1/kmail/kmreaderwin.cpp:1545
#10 0xb73546e7 in KMReaderWin::qt_metacall (this=0x85168d0, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0xbfa4ab38) at /home/alex/kmail/kdepim-4.3.1-build/kmail/kmreaderwin.moc:168
#11 0xb68b7b33 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQtCore.so.4
#12 0xb68b8782 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#13 0xb68f3177 in QTimer::timeout() () from /usr/lib/libQtCore.so.4
#14 0xb68bde9e in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/libQtCore.so.4
#15 0xb68b2bcf in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#16 0xb5d86814 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#17 0xb5d8e97e in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#18 0xb7d504ad in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#19 0xb68a29cb in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#20 0xb68d1361 in ?? () from /usr/lib/libQtCore.so.4
#21 0xb68cd900 in ?? () from /usr/lib/libQtCore.so.4
#22 0xb42a84b8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#23 0xb42aba13 in ?? () from /usr/lib/libglib-2.0.so.0
#24 0xb42abb98 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#25 0xb68cd858 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#26 0xb5e25fd5 in ?? () from /usr/lib/libQtGui.so.4
#27 0xb68a101a in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#28 0xb68a1462 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#29 0xb68a38b9 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#30 0xb5d86697 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#31 0x0804a800 in main (argc=) at /home/alex/kmail/kdepim-4.3.1/kmail/main.cpp:146
Comment 42 Allen Winter 2009-12-07 16:17:59 UTC
SVN commit 1059860 by winterz:

No time like a beta test to finally commit the patch for the old parseMsg() crash.
Let's try it and see if anyone complains.

Don't backport.
MERGE: e4,akonadi-ports
BUG: 53185


 M  +5 -0      kmreaderwin.cpp  


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