<<< Date Index >>>     <<< Thread Index >>>

Segmentation Fault after composing message



I just noticed that after composing a message, on closing of the
editor in which I edited the message, I got a segmentation fault from
mutt (1.5.6).  Have tried to check a bit and built mutt with
debugging, and found the following problem:

in parse.c:1058:

      /*
       * HACK - mutt has, for a very short time, produced negative
       * Lines header values.  Ignore them.
       */
      if (hdr->lines < 0)
        hdr->lines = 0;

But that doesn't check if hdr is NULL, which it was, in that case (gdb
shows it), and previously there is a check, so apparently it could
really get a NULL there.

Without getting much into the logic (had no time or will for it) of
why it gets a NULL there and what happens exactly, the attached patch
to mutt-1.5.6 solves this problem - not sure if that's the correct
way, though.

  Thanks,
  -- Tom

-- 
  Tom Alsberg - hacker (being the best description fitting this space)
  Web page:     http://www.cs.huji.ac.il/~alsbergt/
DISCLAIMER:  The above message does not even necessarily represent what
my fingers have typed on the keyboard, save anything further.
diff -urN mutt-1.5.6.orig/parse.c mutt-1.5.6/parse.c
--- mutt-1.5.6.orig/parse.c     Wed Nov  5 11:41:33 2003
+++ mutt-1.5.6/parse.c  Thu Jun 24 09:37:39 2004
@@ -1052,15 +1052,16 @@
     case 'l':
     if (!ascii_strcasecmp (line + 1, "ines"))
     {
-      if (hdr)
+      if (hdr) {
        hdr->lines = atoi (p);
 
-      /* 
-       * HACK - mutt has, for a very short time, produced negative
-       * Lines header values.  Ignore them. 
-       */
-      if (hdr->lines < 0)
-       hdr->lines = 0;
+        /* 
+         * HACK - mutt has, for a very short time, produced negative
+         * Lines header values.  Ignore them. 
+         */
+        if (hdr->lines < 0)
+         hdr->lines = 0;
+      }
 
       matched = 1;
     }