1 Return-Path: <m.walters@qmul.ac.uk>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 28AB2431FC0
\r
6 for <notmuch@notmuchmail.org>; Tue, 7 Aug 2012 00:07:28 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id IxGIHB1npRPQ for <notmuch@notmuchmail.org>;
\r
17 Tue, 7 Aug 2012 00:07:27 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 4B077431FAF
\r
22 for <notmuch@notmuchmail.org>; Tue, 7 Aug 2012 00:07:27 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1Sydsv-0004Wx-5r; Tue, 07 Aug 2012 08:07:23 +0100
\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]
\r
29 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)
\r
30 (envelope-from <m.walters@qmul.ac.uk>)
\r
31 id 1Sydsu-0004hu-QX; Tue, 07 Aug 2012 08:07:21 +0100
\r
32 From: Mark Walters <markwalters1009@gmail.com>
\r
33 To: Ben Gamari <bgamari.foss@gmail.com>, notmuch@notmuchmail.org
\r
34 Subject: Re: Segmentation fault in notmuch search --format=json
\r
35 In-Reply-To: <871ujjuu2z.fsf@gmail.com>
\r
36 References: <871ujjuu2z.fsf@gmail.com>
\r
37 User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1
\r
38 (x86_64-pc-linux-gnu)
\r
39 Date: Tue, 07 Aug 2012 08:07:14 +0100
\r
40 Message-ID: <878vdrp4d9.fsf@qmul.ac.uk>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
43 X-Sender-Host-Address: 94.192.233.223
\r
44 X-QM-SPAM-Info: Sender has good ham record. :)
\r
45 X-QM-Body-MD5: cb4bcd839c256c4625019fd72fc50e77 (of first 20000 bytes)
\r
46 X-SpamAssassin-Score: -1.8
\r
47 X-SpamAssassin-SpamBar: -
\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
50 spam. We require at least 5.0 points to mark a message as spam.
\r
51 This message scored -1.8 points.
\r
52 Summary of the scoring:
\r
53 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
55 * [138.37.6.40 listed in list.dnswl.org]
\r
56 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
57 provider * (markwalters1009[at]gmail.com)
\r
58 * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
\r
60 * 0.5 AWL AWL: From: address is in the auto white-list
\r
61 X-QM-Scan-Virus: ClamAV says the message is clean
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Tue, 07 Aug 2012 07:07:28 -0000
\r
76 On Tue, 07 Aug 2012, Ben Gamari <bgamari.foss@gmail.com> wrote:
\r
77 > It seems some messages trigger a segmentation fault in
\r
78 > `do_search_threads()`. It appears the problem occurs (at least) when
\r
79 > `authors` is NULL.
\r
81 Hi thanks for the bug report and detailed debugging. I think I can see
\r
82 the problem and there is a test patch to fix it below, and this does
\r
83 appear to be a regression.
\r
85 In json.c the function json_quote_str explicitly checks/allows for a
\r
86 NULL pointer passed as a string and pretends it is just an empty
\r
87 string. That behaviour was lost in the move to structured formatters.
\r
89 A simple fix is to put this check for a null pointer in json_string in
\r
90 sprinter-json.c which is what this patch does.
\r
92 Incidentally this is the second time this bug has appeared:
\r
94 commit cacefbf3d6dd5bce0b60b3cdfce29bfa371dfaea
\r
95 Author: David Edmondson <dme@dme.org>
\r
96 Date: Tue Apr 6 08:24:00 2010 +0100
\r
98 json: Avoid calling strlen(NULL)
\r
100 MIME parts may have no filename, which previously resulted in calling
\r
103 so it really might be worth having a test for it!
\r
105 Finally, I think nothing in json.c is used anymore so perhaps it
\r
109 diff --git a/sprinter-json.c b/sprinter-json.c
\r
110 index c9b6835..0a07790 100644
\r
111 --- a/sprinter-json.c
\r
112 +++ b/sprinter-json.c
\r
113 @@ -118,6 +118,8 @@ json_string_len (struct sprinter *sp, const char *val, size_t len)
\r
115 json_string (struct sprinter *sp, const char *val)
\r
119 json_string_len (sp, val, strlen (val));
\r