Bus Error on certain keys [Patch provided]

Jack Repenning jack at netgate.net
Wed May 26 05:36:52 CEST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

gpg --list-secret-keys --with-colons
crashes (bus error).  Seems to be related to one of my keys in 
particular.  Maybe:  if I do
gpg --list-secret-keys --with-colons KeyID
for every secret key ID, there's no problem. But if I let it walk the 
list of secret keys, it crashes at the same place every time.

(Tried to check the archives first, but SF won't let me in ... perhaps 
because I just joined up because of this situation.  Sorry if this has 
been discussed!)

This is a big problem for me, because wrappers like GPGMail depend on 
the "--with-colons" feature.

I have found a patch that makes it not crash.  I found the patch by 
local inspection (the crashing line is using a pointer that's NULL; no 
other line in its block uses that pointer; I switched it to use the 
pointer everyone else does). But I don't follow the code well enough to 
understand the meaning of this change, and its effect on the output 
surprises me a bit (lines come out in different order, I only expected 
processing to not crash).  Oddly, on my G4 TiBook with Panther (and the 
same keys), The problem does not occur.  So I'm not real sure about 
this...

Platform is OS 10.2.8 (iMac flat panel 833MHz, 1Gb RAM)
gpg versions showing the problem:
- - - 1.2.3 (latest download for Jaguar)
- - - 1.2.4 (built it myself from 
ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.2.4.tar.gz)

The patch:

 > diff -w -U10 g10/keylist.c~ g10/keylist.c
- - --- g10/keylist.c~      Fri Oct  3 05:50:30 2003
+++ g10/keylist.c       Mon May 24 21:17:49 2004
@@ -806,22 +806,22 @@
                   printf("%c", trustletter );
              }
              printf(":%u:%d:%08lX%08lX:%s:%s:",
                         nbits_from_pk( pk2 ),
                         pk2->pubkey_algo,
                         (ulong)keyid2[0],(ulong)keyid2[1],
                         colon_datestr_from_pk( pk2 ),
                         colon_strtime (pk2->expiredate)
                         /* fixme: add LID and ownertrust here */
                                                 );
- - -            if( pk->local_id ) /* use the local_id of the main 
key??? */
- - -                printf("%lu", pk->local_id );
+            if( pk2->local_id ) /* use the local_id of the main key??? 
*/
+                printf("%lu", pk2->local_id );
              putchar(':');
              putchar(':');
              putchar(':');
              putchar(':');
              print_capabilities (pk2, NULL, NULL);
              putchar('\n');
             if( fpr > 1 )
                 print_fingerprint( pk2, NULL, 0 );
             if( opt.with_key_data )
                 print_key_data( pk2, keyid2 );



The symptoms:

 > g10/gpg --list-secret-keys --with-colons
...
sec::1024:17:51F13EED3B82E870:1997-07-12::::Jack Repenning (Permanent 
DSS key) <jackr at informix.com>:::
uid:::::::::Jack Repenning <jack at netgate.net>:
uid:::::::::Jack Repenning <jackr at bigfoot.com>:
uid:::::::::Jack Repenning <jackr at informix.com>:
uid:::::::::At-work Jack:
uid:::::::::Jack Repenning <jackr at cryptorights.org>:
uid:::::::::Thawte Freemail Member <jackr at informix.com>:
uat:::::::::1 3321:
uid:::::::::John Allan Repenning <jackr at informix.com>:
uid:::::::::Jack Repenning (work DSS) <jrepenning at catapulse.com>:
Bus error



And yet:
 > g10/gpg --list-secret-keys --with-colons 51F13EED3B82E870
sec::1024:17:51F13EED3B82E870:1997-07-12::::Jack Repenning 
<jrepenning at collab.net>::scSC:
uid:::::::::Jack Repenning (work DSS) <jrepenning at catapulse.com>:
uid:::::::::Jack Repenning (Permanent DSS key) <jackr at informix.com>:
uid:::::::::Jack Repenning <jack at netgate.net>:
uid:::::::::Jack Repenning <jackr at bigfoot.com>:
uid:::::::::Jack Repenning <jackr at informix.com>:
uid:::::::::At-work Jack:
uid:::::::::Jack Repenning <jackr at cryptorights.org>:
uat:::::::::1 3321:
uid:::::::::John Allan Repenning <jackr at informix.com>:
uid:::::::::Thawte Freemail Member <jackr at informix.com>:
uid:::::::::Jack Repenning <jrepenning at rational.com>:

After the patch:
...
sec::1024:17:51F13EED3B82E870:1997-07-12::::Jack Repenning (Permanent 
DSS key) <jackr at informix.com>:::
uid:::::::::Jack Repenning <jack at netgate.net>:
uid:::::::::Jack Repenning <jackr at bigfoot.com>:
uid:::::::::Jack Repenning <jackr at informix.com>:
uid:::::::::At-work Jack:
uid:::::::::Jack Repenning <jackr at cryptorights.org>:
uid:::::::::Thawte Freemail Member <jackr at informix.com>:
uat:::::::::1 3321:
uid:::::::::John Allan Repenning <jackr at informix.com>:
uid:::::::::Jack Repenning (work DSS) <jrepenning at catapulse.com>:
sub:i:2048:16:A5EF280B1A877C4F:1997-07-12:::::::
sub:i:3072:16:D895FC426A299E29:2000-02-18:::::::
...


What gdb has to say about the matter:
...
sec::1024:17:51F13EED3B82E870:1997-07-12::::Jack Repenning (Permanent 
DSS key) <jackr at informix.com>:::
uid:::::::::Jack Repenning <jack at netgate.net>:
uid:::::::::Jack Repenning <jackr at bigfoot.com>:
uid:::::::::Jack Repenning <jackr at informix.com>:
uid:::::::::At-work Jack:
uid:::::::::Jack Repenning <jackr at cryptorights.org>:
uid:::::::::Thawte Freemail Member <jackr at informix.com>:
uat:::::::::1 3321:
uid:::::::::John Allan Repenning <jackr at informix.com>:
uid:::::::::Jack Repenning (work DSS) <jrepenning at catapulse.com>:

Program received signal EXC_BAD_ACCESS, Could not access memory.
list_keyblock_colon (keyblock=0x2280e0, secret=536643, fpr=0) at 
keylist.c:816
816                 if( pk->local_id ) /* use the local_id of the main 
key??? */
(gdb) where
#0  list_keyblock_colon (keyblock=0x2280e0, secret=536643, fpr=0) at 
keylist.c:816
#1  0x0002719c in list_all (secret=2259792) at keylist.c:225
#2  0x0002719c in list_all (secret=1) at keylist.c:225
#3  0x00006820 in main (argc=0, argv=0xbffffc54) at g10.c:2360
#4  0x00002078 in _start (argc=3, argv=0xbffffc48, envp=0xbffffc58) at 
/SourceCache/Csu/Csu-45/crt.c:267
#5  0x00001ef8 in start ()



<><
Jack Repenning
<mailto:jack at netgate.net>

And the next thing you know,
you're sucking down Darjeeling with Marie Antoinette and her little 
sister!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: GPG-encrypted email preferred

iD8DBQFAtBDdfnZDrTsQK+gRAuPyAKCUuiWdcgyMyMy0MKxVcu8krGdeHACdFtDU
Y4OWVfPCIpXTjzm8KZKjqbs=
=5Vnr
-----END PGP SIGNATURE-----




More information about the Gnupg-devel mailing list