--- /dev/null
+Return-Path: <bgamari.foss@gmail.com>\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 BDF34431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Aug 2012 22:52:56 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 1t6GJM64yfre for <notmuch@notmuchmail.org>;\r
+ Mon, 6 Aug 2012 22:52:56 -0700 (PDT)\r
+Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com\r
+ [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 3C913431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Aug 2012 22:52:56 -0700 (PDT)\r
+Received: by vcbfl17 with SMTP id fl17so4227205vcb.26\r
+ for <notmuch@notmuchmail.org>; Mon, 06 Aug 2012 22:52:55 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:subject:user-agent:date:message-id:mime-version\r
+ :content-type; bh=d9SAUzAOrkWBrcD9slR9knkh4ybgG9nB0O+9ivq3xgc=;\r
+ b=kIMUaNRHLd8e7POck5Lb98TjF1K76JZBxCK0SJ1AjDBdf5nKPyOydH75XAKhcE+SFl\r
+ xVpBjzK81P5g++194hIA2oL1G+Zfe9ZgcU+N+2QAtWD+Jz2xmgaAB+voTN6dRdRbraqn\r
+ 2IVDoaxuM0HPdt2msVWKCECQMZ2FnzCcmUaKVDeKzB8KyCbEWT8tH77KSvy2FxsxKcqr\r
+ JMH0Jvi7YN5zYC4078aBxChc2g1INchE4IlbUXI7jEMyBJN6sXvp0kskCuODAm3rk5Xp\r
+ DvIhQeX8VS3WoF6GQ7S3BdDUdwjUicsVKT5onAzTb5dMZunNyFfRfrIk6Q3PYNxqDi3u\r
+ 5r2A==\r
+Received: by 10.52.89.72 with SMTP id bm8mr8746583vdb.5.1344318775504;\r
+ Mon, 06 Aug 2012 22:52:55 -0700 (PDT)\r
+Received: from localhost (pool-108-8-227-110.spfdma.east.verizon.net.\r
+ [108.8.227.110])\r
+ by mx.google.com with ESMTPS id e9sm17830123vdf.21.2012.08.06.22.52.54\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Mon, 06 Aug 2012 22:52:54 -0700 (PDT)\r
+From: Ben Gamari <bgamari.foss@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: Segmentation fault in notmuch search --format=json\r
+User-Agent: Notmuch/0.13.2+119~g43ac79a (http://notmuchmail.org) Emacs/23.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 07 Aug 2012 01:52:52 -0400\r
+Message-ID: <871ujjuu2z.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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 05:52:56 -0000\r
+\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
+ Program received signal SIGSEGV, Segmentation fault.\r
+ 0x0000000000415aa3 in json_string (sp=0x646c70, val=0x0) at sprinter-json.c:121\r
+ 121 json_string_len (sp, val, strlen (val));\r
+ (gdb) bt\r
+ #0 0x0000000000415aa3 in json_string (sp=0x646c70, val=0x0)\r
+ at sprinter-json.c:121\r
+ #1 0x000000000041084b in do_search_threads (format=0x646c70, query=0x64bb70, \r
+ sort=NOTMUCH_SORT_NEWEST_FIRST, output=OUTPUT_SUMMARY, offset=0, limit=-1)\r
+ at notmuch-search.c:131\r
+ #2 0x0000000000411361 in notmuch_search_command (ctx=0x6361b0, argc=3, \r
+ argv=0x7fffffffdfb0) at notmuch-search.c:405\r
+ #3 0x0000000000409e22 in main (argc=4, argv=0x7fffffffdfa8) at notmuch.c:294\r
+ (gdb) up\r
+ #1 0x000000000041084b in do_search_threads (format=0x646c70, query=0x64bb70, \r
+ sort=NOTMUCH_SORT_NEWEST_FIRST, output=OUTPUT_SUMMARY, offset=0, limit=-1)\r
+ at notmuch-search.c:131\r
+ 131 format->string (format, authors);\r
+ (gdb) list\r
+ 126 format->map_key (format, "matched");\r
+ 127 format->integer (format, matched);\r
+ 128 format->map_key (format, "total");\r
+ 129 format->integer (format, total);\r
+ 130 format->map_key (format, "authors");\r
+ 131 format->string (format, authors);\r
+ 132 format->map_key (format, "subject");\r
+ 133 format->string (format, subject);\r
+ 134 }\r
+ 135 \r
+ (gdb) \r
+\r
+It seems that the message in question was produced by a script I use to\r
+feed RSS feeds into notmuch so while I wouldn't doubt that there are few\r
+cases where `authors` should be NULL, it would be nice if notmuch\r
+handled this case with a bit more grace.\r
+\r
+Cheers,\r
+\r
+- Ben\r
+\r