segfault if notmuch-show query has spurious .. (w/ v0.17)

David Bremner david at tethera.net
Wed Jan 22 04:40:56 PST 2014


Sanjoy Mahajan <sanjoy at 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


More information about the notmuch mailing list