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 210E0431FBD for ; Tue, 2 Mar 2010 07:54:21 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599] autolearn=ham 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 b7Cp5IyLNkzT for ; Tue, 2 Mar 2010 07:54:15 -0800 (PST) Received: from clegg.madduck.net (clegg.madduck.net [193.242.105.96]) by olra.theworths.org (Postfix) with ESMTP id BA6B3431FAE for ; Tue, 2 Mar 2010 07:54:15 -0800 (PST) Received: from piper.oerlikon.madduck.net (unknown [IPv6:2001:1620:f02:0:211:2fff:fe6b:c869]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "piper.oerlikon.madduck.net", Issuer "CAcert Class 3 Root" (verified OK)) by clegg.madduck.net (postfix) with ESMTPS id 31E271D40D0; Tue, 2 Mar 2010 16:54:00 +0100 (CET) Received: by piper.oerlikon.madduck.net (Postfix, from userid 1000) id 366F7C0; Tue, 2 Mar 2010 16:31:33 +0100 (CET) From: "martin f. krafft" To: notmuch@notmuchmail.org Date: Tue, 2 Mar 2010 16:31:28 +0100 Message-Id: <1267543888-18134-1-git-send-email-madduck@madduck.net> X-Mailer: git-send-email 1.7.0 X-Virus-Scanned: clamav-milter 0.95.3 at clegg X-Virus-Status: Clean Cc: "martin f. krafft" Subject: [notmuch] [PATCH] Do not segfault on empty mime parts 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, 02 Mar 2010 15:54:21 -0000 notmuch previously unconditionally checked mime parts for various properties, but not for NULL, which is the case if libgmime encounters an empty mime part. Upon encounter of an empty mime part, the following is printed to stderr (the second line due to my patch): (process:17197): gmime-CRITICAL **: g_mime_message_get_mime_part: assertion `GMIME_IS_MESSAGE (message)' failed Warning: Not indexing empty mime part. This is probably a bug that should get addressed in libgmime, but for not, my patch is an acceptable workaround. Signed-off-by: martin f. krafft --- lib/index.cc | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/lib/index.cc b/lib/index.cc index cf93025..0d6640b 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -336,6 +336,11 @@ _index_mime_part (notmuch_message_t *message, GMimeContentDisposition *disposition; char *body; + if (! part) { + fprintf (stderr, "Warning: Not indexing empty mime part.\n"); + return; + } + if (GMIME_IS_MULTIPART (part)) { GMimeMultipart *multipart = GMIME_MULTIPART (part); int i; -- 1.7.0