From a258cb32b318d831fab5ef64329bd65119b47def Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 27 Apr 2010 16:29:22 -0700 Subject: [PATCH 1/6] Fix SEGV in _thread_cleanup_author if author ends with ', ' Admittedly, an author name ending in ',' guarantees this is spam, and indeed this was triggered by a spam email, but that doesn't mean we shouldn't handle this case correctly. We now check that there is actually a component of the name (presumably the first name) after the comma in the author name. Signed-off-by: Dirk Hohndel --- lib/thread.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/thread.cc b/lib/thread.cc index dc74ee3e..13872d46 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -156,11 +156,19 @@ _thread_cleanup_author (notmuch_thread_t *thread, char *blank; int fname,lname; + if (author == NULL) + return NULL; clean_author = talloc_strdup(thread, author); if (clean_author == NULL) return NULL; + /* check if there's a comma in the name and that there's a + * component of the name behind it (so the name doesn't end with + * the comma - in which case the string that strchr finds is just + * one character long ",\0"). + * Otherwise just return the copy of the original author name that + * we just made*/ comma = strchr(author,','); - if (comma) { + if (comma && strlen(comma) > 1) { /* let's assemble what we think is the correct name */ lname = comma - author; fname = strlen(author) - lname - 2; @@ -180,7 +188,6 @@ _thread_cleanup_author (notmuch_thread_t *thread, /* we didn't identify this as part of the email address * so let's punt and return the original author */ strcpy (clean_author, author); - } return clean_author; } From 6a76555b42888a8f194a05e523328cd9975948fd Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 27 Apr 2010 16:29:23 -0700 Subject: [PATCH 2/6] Update NEWS to reflect the SEGV bugfix Signed-off-by: Dirk Hohndel --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index ce0ea452..035e25e6 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ Notmuch 0.3.1 (2010-04-27) ========================== General bug fix --------------- +Fix a potential SEGV in "notmuch search" + + This bug could be triggered by an author name ending in a ','. + Admittedly - that's almost certainly a spam email. Still needs + to be handled correctly. + Fix an infinite loop in "notmuch reply" This bug could be triggered by replying to a message where the From fe5d0f3e11ab34d2367edcd7ad044747373f31a9 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 27 Apr 2010 16:56:24 -0700 Subject: [PATCH 3/6] NEWS: Reword the latest bug description slightly. "Still needs to be handled correctly" could be misread to suggest that the bug has not actually been fixed yet. So clarify what is actually meant here, (that the bug is unlikely but we're still motivated to fix it). --- NEWS | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 035e25e6..40fb900f 100644 --- a/NEWS +++ b/NEWS @@ -1,13 +1,7 @@ Notmuch 0.3.1 (2010-04-27) ========================== -General bug fix ---------------- -Fix a potential SEGV in "notmuch search" - - This bug could be triggered by an author name ending in a ','. - Admittedly - that's almost certainly a spam email. Still needs - to be handled correctly. - +General bug fixes +----------------- Fix an infinite loop in "notmuch reply" This bug could be triggered by replying to a message where the @@ -15,6 +9,12 @@ Fix an infinite loop in "notmuch reply" the user had not configured any secondary email addresses. The bug was a simple re-use of the same iterator variable in nested loops. +Fix a potential SEGV in "notmuch search" + + This bug could be triggered by an author name ending in a ','. + Admittedly - that's almost certainly a spam email, but we never + want notmuch to crash. + Emacs bug fixes --------------- Fix calculations for line wrapping in the primary "notmuch" view. From 774225b8b55cbb65cf5d59568b81b9244a0b240f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 27 Apr 2010 17:00:34 -0700 Subject: [PATCH 4/6] Increment version to 0.3.1 For our 0.3.1 bug-fix release. --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index be586341..9e11b32f 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.3 +0.3.1 From f635a0177bf2c6d8bf235c1088f90fc77cdddf18 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 27 Apr 2010 17:02:17 -0700 Subject: [PATCH 5/6] debian/changelog: Copy in content from the NEWS file. Someday we'll automate this step. --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index d0c13ba6..66589c18 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +notmuch (0.3.1) unstable; urgency=low + + * Fix an infinite loop in "notmuch reply" + * Fix a potential SEGV in "notmuch search" + * emacs: Fix calculations for line wrapping in the "notmuch" view. + * emacs: Fix Fcc support to prompt to create a directory if necessary + + -- Carl Worth Tue, 27 Apr 2010 17:02:07 -0700 + notmuch (0.3) unstable; urgency=low * User-configurable tags for new messages From e9e1466b441769f77391080ee8d08ec1afac7a61 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 27 Apr 2010 17:04:52 -0700 Subject: [PATCH 6/6] debian: Instruct git-buildpackage that it's OK to build from this branch I wish I had something with better support for a native Debian package here. I shouldn't ever have to configure any branch---I just want it to build a package from the current branch. Instead it makes me tell it (twice!) what the current branch actually is. --- debian/gbp.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/gbp.conf b/debian/gbp.conf index dba526f6..a4794f1c 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -2,10 +2,10 @@ [DEFAULT] # The default branch for upstream sources -upstream-branch = master +upstream-branch = 0.3.x # The default branch for the debian patch (no patch in our case) -debian-branch = master +debian-branch = 0.3.x # Directory for performing the build export-dir = ./debian-build