Package: libmail-thread-perl
Version: 2.55-1
Severity: normal
Tags: upstream patch

Dear Maintainer,

With incomplete threads, It is possible to for the topmost subroutine to
return undef, so do not blindy assume the simple_subject call will be
made on a Mail::Thread::Container object.

Attached is a patch which avoids the issue by skipping as if the
subject were empty.

Note: upstream hasn't been responsive in years, but Cc-ing the RT
address at CPAN just in case.

-- System Information:
Debian Release: 7.8
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
-- no debconf information
>From 9d1837f2118efa614d1acddd09ea7f53aba15ba4 Mon Sep 17 00:00:00 2001
From: Eric Wong <[email protected]>
Date: Mon, 17 Aug 2015 21:16:25 +0000
Subject: [PATCH] avoid failing grouping by subject with missing references

It is possible to for the topmost subroutine to return
undef, so do not blindy assume the simple_subject call
will be made on a Mail::Thread::Container object.
---
 Thread.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Thread.pm b/Thread.pm
index c6f3230..941ae31 100644
--- a/Thread.pm
+++ b/Thread.pm
@@ -70,7 +70,8 @@ sub _group_set_bysubject {
 
     my %subject;
     for (my $walk = $root->child; $walk; $walk = $walk->next) {
-        my $sub = $walk->topmost->simple_subject or next;
+        my $topmost = $walk->topmost or next;
+        my $sub = $topmost->simple_subject or next;
         # Add this container to the hash if:
         # - There is no container in the hash with this subject, or
         # - This one is a dummy container and the old one is not: the dummy
@@ -97,7 +98,8 @@ sub _group_set_bysubject {
     for ($walk = $root->child, $rest = eval{ $walk->next };
          $walk;
          $prev = $walk, $walk = $rest, $rest = eval { $rest->next }) {
-        my $subj = $walk->topmost->simple_subject or next;
+        my $topmost = $walk->topmost or next;
+        my $subj = $topmost->simple_subject or next;
         my $old = $subject{$subj};
         next if $old == $walk;
 
-- 
EW

Reply via email to