RE: Reply all - issue
[notmuch-archives.git] / ba / a0c92c23960ddd0ceb54e3fd51d3cc14ed9766
1 Return-Path: <amdragon@mit.edu>\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 0C593431FC4\r
6         for <notmuch@notmuchmail.org>; Tue,  7 Aug 2012 05:49:24 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 1flQOIelNzX8 for <notmuch@notmuchmail.org>;\r
16         Tue,  7 Aug 2012 05:49:20 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id 2487C431FAF\r
20         for <notmuch@notmuchmail.org>; Tue,  7 Aug 2012 05:49:20 -0700 (PDT)\r
21 X-AuditID: 12074423-b7f396d0000008f4-ad-50210ecd9fc5\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id D8.5D.02292.DCE01205; Tue,  7 Aug 2012 08:49:18 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q77CnH6X018421; \r
27         Tue, 7 Aug 2012 08:49:17 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q77CnFZI003356\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Tue, 7 Aug 2012 08:49:16 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1SyjDn-0006EP-Pm; Tue, 07 Aug 2012 08:49:15 -0400\r
37 Date: Tue, 7 Aug 2012 08:49:15 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: Segmentation fault in notmuch search --format=json\r
41 Message-ID: <20120807124857.GN22601@mit.edu>\r
42 References: <871ujjuu2z.fsf@gmail.com>\r
43  <878vdrp4d9.fsf@qmul.ac.uk>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 Content-Disposition: inline\r
47 In-Reply-To: <878vdrp4d9.fsf@qmul.ac.uk>\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)\r
49 X-Brightmail-Tracker:\r
50  H4sIAAAAAAAAA+NgFmpnleLIzCtJLcpLzFFi42IRYrdT1z3HpxhgsOYLs8XyVVIWq+fyWFy/\r
51         OZPZgdlj56y77B7PVt1iDmCK4rJJSc3JLEst0rdL4MqY/fIIY8FTvop53XPZGhibubsYOTkk\r
52         BEwkFsx7ywJhi0lcuLeerYuRi0NIYB+jxPzOpSwQznpGiWPvf0M5J5gkPr3YzwzhLGGU2Lu8\r
53         hRWkn0VAReLg5jVMIDabgIbEtv3LGUFsEQEdiduHFrCD2MwCDhLXb5xnBrGFBewlltycCtbL\r
54         C1Tz+sYSNhBbSMBFon/XXTaIuKDEyZlPWCB6tSRu/HsJNJ8DyJaWWP6PAyTMCbTqyIVHYGNE\r
55         gU6YcnIb2wRGoVlIumch6Z6F0L2AkXkVo2xKbpVubmJmTnFqsm5xcmJeXmqRrplebmaJXmpK\r
56         6SZGcHi7KO9g/HNQ6RCjAAejEg/vBS6FACHWxLLiytxDjJIcTEqivMq8igFCfEn5KZUZicUZ\r
57         8UWlOanFhxglOJiVRHgP7wQq501JrKxKLcqHSUlzsCiJ815LuekvJJCeWJKanZpakFoEk5Xh\r
58         4FCS4J0PMlSwKDU9tSItM6cEIc3EwQkynAdouAIwHQjxFhck5hZnpkPkTzEqSonzSoMkBEAS\r
59         GaV5cL2w9POKURzoFWHevyAreICpC677FdBgJqDB3vJyIINLEhFSUg2MDPPbP0kUFs86y7BL\r
60         4e+6nfvTF3fae/g5VkW8EPuy+KtjR/aepTxqs7/fEY58XFpT/Cx2Ydekw4sX2e7uto6c8HvW\r
61         xm05T49wZd5pWzB7k33b2QNqFbNWPQ6/mJlj1j394LJiwRuTGU7za039s9F53rGUxnVv7wZI\r
62         XalhMo0x2+MXeSSA87AgqxJLcUaioRZzUXEiAOnjdDsaAwAA\r
63 Cc: notmuch@notmuchmail.org\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Tue, 07 Aug 2012 12:49:24 -0000\r
77 \r
78 Quoth Mark Walters on Aug 07 at  8:07 am:\r
79 > On Tue, 07 Aug 2012, Ben Gamari <bgamari.foss@gmail.com> wrote:\r
80 > > It seems some messages trigger a segmentation fault in\r
81 > > `do_search_threads()`. It appears the problem occurs (at least) when\r
82 > > `authors` is NULL.\r
83\r
84 > Hi thanks for the bug report and detailed debugging. I think I can see\r
85 > the problem and there is a test patch to fix it below, and this does\r
86 > appear to be a regression.\r
87\r
88 > In json.c the function json_quote_str explicitly checks/allows for a\r
89 > NULL pointer passed as a string and pretends it is just an empty\r
90 > string. That behaviour was lost in the move to structured formatters.\r
91\r
92 > A simple fix is to put this check for a null pointer in json_string in\r
93 > sprinter-json.c which is what this patch does.\r
94\r
95 > Incidentally this is the second time this bug has appeared: \r
96\r
97 >         commit cacefbf3d6dd5bce0b60b3cdfce29bfa371dfaea\r
98 >         Author: David Edmondson <dme@dme.org>\r
99 >         Date:   Tue Apr 6 08:24:00 2010 +0100\r
100\r
101 >             json: Avoid calling strlen(NULL)\r
102 >                 \r
103 >                     MIME parts may have no filename, which previously resulted in calling\r
104 >                         strlen(NULL).\r
105\r
106 > so it really might be worth having a test for it!\r
107\r
108 > Finally, I think nothing in json.c is used anymore so perhaps it\r
109 >  could be removed.\r
110 \r
111 LGTM.  We'll want to do something similar for text_string and, of\r
112 course, update the sprinter doc comments.\r
113 \r
114 > diff --git a/sprinter-json.c b/sprinter-json.c\r
115 > index c9b6835..0a07790 100644\r
116 > --- a/sprinter-json.c\r
117 > +++ b/sprinter-json.c\r
118 > @@ -118,6 +118,8 @@ json_string_len (struct sprinter *sp, const char *val, size_t len)\r
119 >  static void\r
120 >  json_string (struct sprinter *sp, const char *val)\r
121 >  {\r
122 > +    if (val == NULL)\r
123 > +     val = "";\r
124 >      json_string_len (sp, val, strlen (val));\r
125 >  }\r
126 >  \r