unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "Olivier Taïbi" <oli@olitb.net>
To: notmuch@notmuchmail.org
Subject: segfault in T590-libconfig notmuch_database_get_config_list: closed db
Date: Tue, 27 Oct 2020 11:09:16 +0100	[thread overview]
Message-ID: <20201027100916.emry3k2wujod4xnl@galois.lan> (raw)

The test mentioned in the subject triggers a segfault.  This is with
xapian-core-1.4.16 on OpenBSD.  Here is the backtrace:

#0  0x000005c9d491bec2 in Xapian::TermIterator::decref() () from /usr/local/lib/libxapian.so.5.1
#1  0x000005c948827062 in Xapian::TermIterator::~TermIterator (this=0x5c9d2fdb068) at /usr/local/include/xapian/termiterator.h:85
#2  _notmuch_config_list_destroy (list=<optimized out>) at lib/config.cc:38
#3  0x000005c97e08050a in ?? () from /usr/local/lib/libtalloc.so.1.1
#4  0x000005c94882700f in notmuch_database_get_config_list (notmuch=0x5c9cb714e60, prefix=<optimized out>, out=0x7f7ffffc98e8) at lib/config.cc:137
#5  0x000005c6ff617c37 in main (argc=2, argv=0x7f7ffffc9998) at test2.c:16

For convenience, here is test2.c:
<----- begin test2.c ----->
#include <string.h>
#include <stdlib.h>
#include <notmuch-test.h>

int main (int argc, char** argv)
{
   notmuch_database_t *db;
   char *val;
   notmuch_status_t stat;

   EXPECT0(notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db));

{
   notmuch_config_list_t *list;
   EXPECT0(notmuch_database_close (db));
   stat = notmuch_database_get_config_list (db, "nonexistent", &list);
   printf("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION);
}
   EXPECT0(notmuch_database_destroy(db));
}
<----- end test2.c ----->

In frame 4, we see that the iterator was not initialized:
(gdb) p *list
$7 = {notmuch = 0x5c9cb714e60, iterator = {internal = 0xdfdfdfdfdfdfdfdf}, current_key = 0x0, current_val = 0x0}

             reply	other threads:[~2020-10-27 10:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 10:09 Olivier Taïbi [this message]
2020-10-28 11:21 ` segfault in T590-libconfig notmuch_database_get_config_list: closed db David Bremner
2020-10-30  0:19 ` [PATCH] lib/config: don't set destructor until iterator is initialized David Bremner
2020-10-31 17:49   ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027100916.emry3k2wujod4xnl@galois.lan \
    --to=oli@olitb.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).