From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 66F61431FBD for ; Wed, 22 Jan 2014 04:41:10 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l4sylLm+w-Tr for ; Wed, 22 Jan 2014 04:41:06 -0800 (PST) Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 5413A431FAF for ; Wed, 22 Jan 2014 04:41:06 -0800 (PST) Received: from remotemail by yantan.tethera.net with local (Exim 4.80) (envelope-from ) id 1W5x76-0000rb-KS; Wed, 22 Jan 2014 08:41:00 -0400 Received: (nullmailer pid 3724 invoked by uid 1000); Wed, 22 Jan 2014 12:40:56 -0000 From: David Bremner To: Sanjoy Mahajan , notmuch@notmuchmail.org Subject: Re: segfault if notmuch-show query has spurious .. (w/ v0.17) In-Reply-To: <871u00oimv.fsf@approx.mit.edu> References: <871u00oimv.fsf@approx.mit.edu> User-Agent: Notmuch/0.17+35~g3b36898 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 22 Jan 2014 08:40:56 -0400 Message-ID: <8738kgrxyf.fsf@zancas.localnet> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 12:41:10 -0000 Sanjoy Mahajan writes: > Probably because I kept using notmuch-emacs .elc code from 0.16 after > notmuch got upgraded to 0.17 (I rarely restart emacs), my Emacs > interface to notmuch started generating queries that caused Xapian > exceptions and segfaults. Here's one: > > $ notmuch show '( FW: Student Employment Orie.. )' > A Xapian exception occurred performing query: Unknown range operation > Query string was: ( FW: Student Employment Orie.. ) > Segmentation fault > > Restarting Emacs stopped those queries, so I don't think that's an > issue. However, notmuch itself probably should not segfault, even if > Xapian gets confused by the .. in the query (making it look like a date > range). > Looking at the example code in lib/notmuch.h (which, surprise, we use in notmuch-show), we see for (threads = notmuch_query_search_threads (query); notmuch_threads_valid (threads); notmuch_threads_move_to_next (threads)) { thread = notmuch_threads_get (threads); .... notmuch_thread_destroy (thread); } notmuch_query_search_theads documents that it might return NULL, but notmuch_threads_valid does not handle NULL input. It seems to me that notmuch_threads_valid should just return FALSE on NULL input. d