Bug 83093

Summary: Crash when composing mail for recipient with known expired PGP key
Product: [Unmaintained] kmail Reporter: Stephan Binner <binner>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED WORKSFORME    
Severity: crash CC: esken
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Stephan Binner 2004-06-09 12:14:37 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Have an expired PGP key (culprit here 0xEB3B7E0D), Message/New Message, enter an address of the key into "To:" and wait (one or two minutes?). Don't know what it triggers but:

kmail: Kleo::KeyResolver::lookup( "Dirk Mueller <mueller@kde.org>", false ) 
kmail:   returned 2 keys 
*** KMail got signal 11 (Crashing)
Comment 1 Ingo Klöcker 2004-06-12 00:44:17 UTC
Stephan, you should really know that a backtrace would be extremly helpful.

Since I can't reproduce the crash I can't fix it.
Comment 2 Stephan Binner 2004-06-12 09:45:21 UTC
I will post a backtrace when you help me to make valgrind print out more than its help on my system. ;-(

I traced it now manually to 

  matchingKeys.erase( std::remove_if( matchingKeys.begin(), matchingKeys.end(),
				      NotValidTrustedEncryptionKey ),
		      matchingKeys.end() );

in Kleo::KeyResolver::getEncryptionKeys().
Comment 3 Stephan Kulow 2004-06-12 11:38:40 UTC
--tool=addrcheck is most likely the option valgrind is trying to help you to :)
Comment 4 Stephan Binner 2004-06-12 13:29:58 UTC
Here we go:

kmail:   returned 2 keys
==11744== Warning: client syscall munmap tried to modify addresses 0xCAD0B991-0x82B3A88
==11744==
==11744== Invalid read of size 4
==11744==    at 0x3D59CC20: fREe (in /opt/kde-head/lib/libkdecore.so.4.2.0)
==11744==    by 0x3D59D015: free (in /opt/kde-head/lib/libkdecore.so.4.2.0)
==11744==    by 0x3D0F78C4: gpgme_key_unref (key.c:324)
==11744==    by 0x3D0E819F: GpgME::Key::~Key() (key.cpp:69)
==11744==  Address 0x4816D274 is not stack'd, malloc'd or (recently) free'd
*** KMail got signal 11 (Crashing)

gpgme 0.3.16 / SUSE 9.1
Comment 5 Marc Mutz 2004-06-20 20:09:07 UTC
> gpgme 0.3.16

I assume you are using KMail HEAD? How did you get it to compile against a 0.3-branch gpgme? Try again with >= 0.4.5, please.
Comment 6 Stephan Binner 2004-06-20 20:30:44 UTC
> I assume you are using KMail HEAD?

Yes.

> How did you get it to compile against a 0.3-branch gpgme? 

That was a mindless mention of the distribution version which is not used. Actually in use is 

You are missing gpgme 0.4.5 or higher.
Gpgme will be built statically from libkdenetwork/libgpgme-copy.

that's also why above gpgme version has debug information. Sorry for confusion. :-)
Comment 7 Till Adam 2004-07-18 16:38:49 UTC
Stephan, does current cvs still crash for you?
Comment 8 Till Adam 2004-07-18 17:00:08 UTC
*** Bug 84028 has been marked as a duplicate of this bug. ***
Comment 9 Stephan Binner 2004-07-18 22:48:21 UTC
With same address and keys from above I just tried and it didn't crash.
Comment 10 Stephan Binner 2004-07-18 22:53:30 UTC
Till says "close it". :-)