[GPGME] statefulness of gpgme_op_keylist_*

Daiki Ueno ueno at unixuser.org
Wed Oct 18 12:07:48 CEST 2006


As gpgme_op_keylist_* are expected to be called in certain order, and
gpgme_op_delete resets the opdata, the following code dumps core on 1.

gpgme_new (&ctx);
gpgme_op_keylist_start (ctx, NULL, 0);
gpgme_op_keylist_next (ctx, &key);
gpgme_op_delete (ctx, key);
gpgme_op_keylist_next (ctx, &key); /* 1 */

Program terminated with signal 11, Segmentation fault.
#0  gpgme_op_keylist_next (ctx=0x804a030, r_key=0xbf867974) at keylist.c:887
887       if (!opd->key_queue)
(gdb) where
#0  gpgme_op_keylist_next (ctx=0x804a030, r_key=0xbf867974) at keylist.c:887
#1  0x0804866e in main () at test-keylist-next.c:28

Though this behavior might be intentional, may I request to change it to
return an error (possibly GPG_ERR_INV_STATE?) on 1 rather than SEGV?

Daiki Ueno

More information about the Gnupg-devel mailing list