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