From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MJ2xEmvzl19NTwAA0tVLHw (envelope-from ) for ; Tue, 27 Oct 2020 10:16:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SO+RDmvzl19uGAAAB5/wlQ (envelope-from ) for ; Tue, 27 Oct 2020 10:16:11 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 92F159402A2 for ; Tue, 27 Oct 2020 10:16:09 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 23BD6270E7; Tue, 27 Oct 2020 06:16:01 -0400 (EDT) X-Greylist: delayed 397 seconds by postgrey-1.36 at nmbug; Tue, 27 Oct 2020 06:15:58 EDT Received: from hilbert.olitb.net (hilbert.olitb.net [89.234.140.190]) by mail.notmuchmail.org (Postfix) with ESMTPS id 56A782000F for ; Tue, 27 Oct 2020 06:15:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=olitb.net; s=20200719; t=1603793357; bh=dUjNmmc4PGsK0BShC6zaogRtBJeZ0s0dRC1FhSA4+f8=; h=subject:to:from:date; b=OLadByhxbWi2aO32HefbWLp/3/d53LxREeXnyN4ZvGmI naYT0eE+NHxtGrKiJvnCj8YDT3C9nx9F9jGlReNRRa3tnX1drWUN0eMYQWyZ+TvqKQF6YG qIGJH0s3QAQfHYMBRmaLuigrFLJDLNY4DnuiSvRijaJ9kLiW5t14COrCo= Received: by hilbert.olitb.net (OpenSMTPD) with ESMTPSA id 2c4c9f2e (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Tue, 27 Oct 2020 11:09:17 +0100 (CET) Date: Tue, 27 Oct 2020 11:09:16 +0100 From: Olivier =?utf-8?B?VGHDr2Jp?= To: notmuch@notmuchmail.org Subject: segfault in T590-libconfig notmuch_database_get_config_list: closed db Message-ID: <20201027100916.emry3k2wujod4xnl@galois.lan> MIME-Version: 1.0 Content-Disposition: inline Message-ID-Hash: CWO75LTED7Z3VYBWPAC6ULVUG26VG4DB X-Message-ID-Hash: CWO75LTED7Z3VYBWPAC6ULVUG26VG4DB X-MailFrom: oli@olitb.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=olitb.net header.s=20200719 header.b=OLadByhx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=olitb.net (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 0.13 X-TUID: MHlZw2BjZg0c 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=) 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=, 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 #include #include 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}