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 1CA35431FAF
\r
6 for <notmuch@notmuchmail.org>; Wed, 8 Aug 2012 14:28:52 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 erSxp7q8C250 for <notmuch@notmuchmail.org>;
\r
16 Wed, 8 Aug 2012 14:28:51 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 54A10431FAE
\r
20 for <notmuch@notmuchmail.org>; Wed, 8 Aug 2012 14:28:51 -0700 (PDT)
\r
21 X-AuditID: 12074425-b7f9b6d0000008c4-23-5022da12613e
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 5F.5D.02244.21AD2205; Wed, 8 Aug 2012 17:28:50 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q78LSoQ3018316;
\r
27 Wed, 8 Aug 2012 17:28:50 -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 q78LSmJ1017281
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Wed, 8 Aug 2012 17:28:49 -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 1SzDo8-0007I1-Ok; Wed, 08 Aug 2012 17:28:48 -0400
\r
37 Date: Wed, 8 Aug 2012 17:28:48 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH] sprinters: bugfix when NULL passed for a string.
\r
41 Message-ID: <20120808212848.GF11179@mit.edu>
\r
42 References: <1344374501-28185-1-git-send-email-amdragon@mit.edu>
\r
43 <1344389313-7886-1-git-send-email-amdragon@mit.edu>
\r
44 <87mx25ulgq.fsf@qmul.ac.uk>
\r
46 Content-Type: text/plain; charset=us-ascii
\r
47 Content-Disposition: inline
\r
48 In-Reply-To: <87mx25ulgq.fsf@qmul.ac.uk>
\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
50 X-Brightmail-Tracker:
\r
51 H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IR4hTV1hW6pRRgsOKLnsXquTwW12/OZHZg
\r
52 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4MnZfO8NSMFWy4uCDPcwNjNuEuxg5OSQETCSW
\r
53 Na1lhbDFJC7cW8/WxcjFISSwj1Fiw+QrzBDOekaJjQvOs0A4J5gkFnzoYodwljBK7L94mx2k
\r
54 n0VARWLn6wlsIDabgIbEtv3LGUFsEQEdiduHFoDVMAtIS3z73cwEYgsLuErc2vMVbDcvUM2s
\r
55 9+sZIYZOYZTofDKPDSIhKHFy5hMWiGYtiRv/XgI1c4ANWv6PA8TkBNp1oNkIpEIU6IQpJ7ex
\r
56 TWAUmoWkeRaS5lkIzQsYmVcxyqbkVunmJmbmFKcm6xYnJ+blpRbpWujlZpbopaaUbmIEhTW7
\r
57 i+oOxgmHlA4xCnAwKvHwam1QChBiTSwrrsw9xCjJwaQkyrvoIlCILyk/pTIjsTgjvqg0J7X4
\r
58 EKMEB7OSCG/1NqAcb0piZVVqUT5MSpqDRUmc90bKTX8hgfTEktTs1NSC1CKYrAwHh5IEr+5N
\r
59 oEbBotT01Iq0zJwShDQTByfIcB6g4fYgNbzFBYm5xZnpEPlTjLoc958/uc0oxJKXn5cqJc6r
\r
60 A1IkAFKUUZoHNweWjl4xigO9JcwbBFLFA0xlcJNeAS1hAlpyWBRsSUkiQkqqgfGC883egz/+
\r
61 GUma8bS0blz17XSHp0NYMEtcMP/HgoXFhotf6jxNTlhTFNP6/bwXC+cSRV/Dslm/v/AG1de9
\r
62 utBSfsC54afcmgY2b8kDDzfpCrlwGE17/7aseeoPmzkHNi1+t1vl1SUOv2/qB2+tOD/5m4WS
\r
63 lVC12k2TrU2Gu5M8MyrUpIWfcCuxFGckGmoxFxUnAgDf6r5dIgMAAA==
\r
64 Cc: notmuch@notmuchmail.org
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Wed, 08 Aug 2012 21:28:52 -0000
\r
81 Quoth Mark Walters on Aug 08 at 10:23 pm:
\r
83 > The string function in a sprinter may be called with a NULL string
\r
84 > pointer (eg if a header is absent). This causes a segfault. We fix
\r
85 > this by checking for a null pointer in the string functions and update
\r
86 > the sprinter documentation.
\r
88 > At the moment some output when format=text is done directly rather than
\r
89 > via an sprinter: in that case a null pointer is passed to printf or
\r
90 > similar and a "(null)" appears in the output. That behaviour is not
\r
91 > changed in this patch.
\r
94 > This is the same as id:"874noe1o0r.fsf@qmul.ac.uk" except for being
\r
95 > based on top of the test in the parent message, and marking the broken
\r
102 > sprinter-json.c | 2 ++
\r
103 > sprinter-text.c | 2 ++
\r
104 > sprinter.h | 4 +++-
\r
105 > test/missing-headers | 2 --
\r
106 > 4 files changed, 7 insertions(+), 3 deletions(-)
\r
108 > diff --git a/sprinter-json.c b/sprinter-json.c
\r
109 > index c9b6835..0a07790 100644
\r
110 > --- a/sprinter-json.c
\r
111 > +++ b/sprinter-json.c
\r
112 > @@ -118,6 +118,8 @@ json_string_len (struct sprinter *sp, const char *val, size_t len)
\r
114 > json_string (struct sprinter *sp, const char *val)
\r
116 > + if (val == NULL)
\r
118 > json_string_len (sp, val, strlen (val));
\r
121 > diff --git a/sprinter-text.c b/sprinter-text.c
\r
122 > index dfa54b5..10343be 100644
\r
123 > --- a/sprinter-text.c
\r
124 > +++ b/sprinter-text.c
\r
125 > @@ -38,6 +38,8 @@ text_string_len (struct sprinter *sp, const char *val, size_t len)
\r
127 > text_string (struct sprinter *sp, const char *val)
\r
129 > + if (val == NULL)
\r
131 > text_string_len (sp, val, strlen (val));
\r
134 > diff --git a/sprinter.h b/sprinter.h
\r
135 > index 5f43175..912a526 100644
\r
138 > @@ -27,7 +27,9 @@ typedef struct sprinter {
\r
139 > * a list or map, followed or preceded by separators). For string
\r
140 > * and string_len, the char * must be UTF-8 encoded. string_len
\r
141 > * allows non-terminated strings and strings with embedded NULs
\r
142 > - * (though the handling of the latter is format-dependent).
\r
143 > + * (though the handling of the latter is format-dependent). For
\r
144 > + * string (but not string_len) the string pointer passed may be
\r
147 > void (*string) (struct sprinter *, const char *);
\r
148 > void (*string_len) (struct sprinter *, const char *, size_t);
\r
149 > diff --git a/test/missing-headers b/test/missing-headers
\r
150 > index e79f922..f14b878 100755
\r
151 > --- a/test/missing-headers
\r
152 > +++ b/test/missing-headers
\r
153 > @@ -29,7 +29,6 @@ thread:XXX 2001-01-05 [1/1] (null); (inbox unread)
\r
154 > thread:XXX 1970-01-01 [1/1] Notmuch Test Suite; (inbox unread)"
\r
156 > test_begin_subtest "Search: json"
\r
157 > -test_subtest_known_broken
\r
158 > output=$(notmuch search --format=json '*' | notmuch_search_sanitize)
\r
159 > test_expect_equal_json "$output" '
\r
161 > @@ -93,7 +92,6 @@ Body
\r
165 > test_begin_subtest "Show: json"
\r
166 > -test_subtest_known_broken
\r
167 > output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)
\r
168 > test_expect_equal_json "$output" '
\r