unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Sanjoy Mahajan <sanjoy@olin.edu>, notmuch@notmuchmail.org
Subject: Re: segfault if notmuch-show query has spurious .. (w/ v0.17)
Date: Wed, 22 Jan 2014 08:40:56 -0400	[thread overview]
Message-ID: <8738kgrxyf.fsf@zancas.localnet> (raw)
In-Reply-To: <871u00oimv.fsf@approx.mit.edu>

Sanjoy Mahajan <sanjoy@olin.edu> 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

  reply	other threads:[~2014-01-22 12:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22  2:27 segfault if notmuch-show query has spurious .. (w/ v0.17) Sanjoy Mahajan
2014-01-22 12:40 ` David Bremner [this message]
2014-01-22 16:42   ` [PATCH] lib: make notmuch_threads_valid return FALSE when passed NULL David Bremner
2014-01-22 17:30     ` Tomi Ollila
2014-01-23 12:23       ` Round 2: fix for notmuch show segfault David Bremner
2014-01-23 12:23         ` [PATCH 1/3] test: add known broken test exit code of notmuch show David Bremner
2014-01-23 12:24         ` [PATCH 2/3] lib: make notmuch_threads_valid return FALSE when passed NULL David Bremner
2014-01-24 21:06           ` Jani Nikula
2014-01-23 12:24         ` [PATCH 3/3] notmuch-show: detect xapian exception in query David Bremner
2014-01-24 21:12           ` Jani Nikula
2014-01-25  0:41             ` David Bremner
2014-01-23 17:50         ` Round 2: fix for notmuch show segfault Mark Walters
2014-01-24 18:43           ` Tomi Ollila
2014-01-25  1:01 ` segfault if notmuch-show query has spurious .. (w/ v0.17) 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=8738kgrxyf.fsf@zancas.localnet \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    --cc=sanjoy@olin.edu \
    /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).