--- /dev/null
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id F2951431FC4\r
+ for <notmuch@notmuchmail.org>; Tue, 7 Aug 2012 01:08:52 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.29\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 6GU7YWjmaDq5 for <notmuch@notmuchmail.org>;\r
+ Tue, 7 Aug 2012 01:08:51 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+ [131.215.239.19])\r
+ by olra.theworths.org (Postfix) with ESMTP id 01A9D431FAF\r
+ for <notmuch@notmuchmail.org>; Tue, 7 Aug 2012 01:08:50 -0700 (PDT)\r
+Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+ by earth-doxen-postvirus (Postfix) with ESMTP id 7604E66E00C2;\r
+ Tue, 7 Aug 2012 01:08:48 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.192.57])\r
+ (Authenticated sender: jrollins)\r
+ by earth-doxen-submit (Postfix) with ESMTP id 519BD66E00A9;\r
+ Tue, 7 Aug 2012 01:08:44 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+ id C1D5A55B; Tue, 7 Aug 2012 01:08:43 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Mark Walters <markwalters1009@gmail.com>,\r
+ Ben Gamari <bgamari.foss@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: Segmentation fault in notmuch search --format=json\r
+In-Reply-To: <878vdrp4d9.fsf@qmul.ac.uk>\r
+References: <871ujjuu2z.fsf@gmail.com> <878vdrp4d9.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.13.2+136~g6c0183b (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 07 Aug 2012 01:08:40 -0700\r
+Message-ID: <87pq73jf92.fsf@servo.finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+ micalg=pgp-sha256; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 07 Aug 2012 08:08:53 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Tue, Aug 07 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> On Tue, 07 Aug 2012, Ben Gamari <bgamari.foss@gmail.com> wrote:\r
+>> It seems some messages trigger a segmentation fault in\r
+>> `do_search_threads()`. It appears the problem occurs (at least) when\r
+>> `authors` is NULL.\r
+>\r
+> Hi thanks for the bug report and detailed debugging. I think I can see\r
+> the problem and there is a test patch to fix it below, and this does\r
+> appear to be a regression.\r
+>\r
+> In json.c the function json_quote_str explicitly checks/allows for a\r
+> NULL pointer passed as a string and pretends it is just an empty\r
+> string. That behaviour was lost in the move to structured formatters.\r
+>\r
+> A simple fix is to put this check for a null pointer in json_string in\r
+> sprinter-json.c which is what this patch does.\r
+\r
+Thanks Mark! I was experiencing the same problem and this fixed the\r
+issue before I even got a chance to respond. This seems like a fine\r
+solution.\r
+\r
+> Incidentally this is the second time this bug has appeared:=20\r
+>\r
+> commit cacefbf3d6dd5bce0b60b3cdfce29bfa371dfaea\r
+> Author: David Edmondson <dme@dme.org>\r
+> Date: Tue Apr 6 08:24:00 2010 +0100\r
+>\r
+> json: Avoid calling strlen(NULL)\r
+>=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20\r
+> MIME parts may have no filename, which previously res=\r
+ulted in calling\r
+> strlen(NULL).\r
+>\r
+> so it really might be worth having a test for it!\r
+\r
+Indeed! I think the problematic email in this case was one with no\r
+subject.\r
+\r
+> Finally, I think nothing in json.c is used anymore so perhaps it\r
+> could be removed.\r
+\r
+Agreed.\r
+\r
+jamie.\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.12 (GNU/Linux)\r
+\r
+iQIcBAEBCAAGBQJQIM0JAAoJEO00zqvie6q8C84P/0+M3A6/vj9qdDrQRaOOvFRR\r
+p6vNJ+ebIZegrtS2DzFan7Idy9v+CNnTRt9hEJUO+xJcVZcD2LnwFo43DBeYyAhn\r
+BTDR2IjvHDPKGg3J7uYe7DAjhZdfIJd5BYbXkVd3in3j6EQbQsXiiEua4wqyn3E8\r
+gQB6zZXDEGY9F7Bj/v+PhpNVXNJOfS64QVIc2fWyMUg8Lrj12dYYpEnNS/21pj7S\r
+GbCYFgtcdSk4ODqA3gLoVeZqJ/io//w33hS/P5decwQJkceSNBVppQ7KXImKQqlg\r
+6iXyz9IjDtyBMqVaBuDutWwwJcYxa1+AdKpobyi0RgfcGfX2YKDjqHA1DPo142pz\r
+fVNUviRv8Q2UxIxxKC4BvQGcftUmwlPG+6OlFV9lUL6NAgkf6tIg1vMo8OFm88Y1\r
+ibbxBPe5hCOqq1K+ELUEV8E2VVFBlEBlVyfe9/piWO507bkCAAIubzCV12lX3KHe\r
+otJ2VleJd3Y6/49E/6zV9AGLavEJXjaINtQyNVi7m4yf/MVWdgpwE4hgZxUqF5sJ\r
+aXggn6ppJtGsTtKTC3/Nfu62TImzcEM9OHej5NEO/xU+rTBI6ZUKNNYXMBtv6aYY\r
+IlST5W78DqcW9SJvGJWP+ZbcX8U027yShRy+s8v4uklxUNjcFFjeKvxl35HAoQ00\r
+GYMob3scnwRD67mnAWUd\r
+=DuIz\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r