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

Re: Crashes with the "indent" patch on Mutt v1.5.17



Words by Mun Johl [Fri, Jan 04, 2008 at 11:23:38AM -0800]:
> Hi all,
> 
> Quite a while ago, Jimmy Mäkelä wrote an "indent" patch for Mutt that I
> have been using for a long time.  However, when I applied it to Mutt
> v1.5.17, it caused a crash.  I've attached the patch for reference.
> Note that I compiled with gcc v3.3.2 on a Sun Solaris 8 system.
> 
> I'm hoping there may be someone out there that is familiar with the
> patch, or just willing to help with the debug.
> 
> 
> I last applied the indent-patch to mutt 1.5.15 .  I didn't try 1.5.16;
> but when applied to 1.5.17 mutt crashes when I try to reply to a
> message.  Note that there are no other patches applied.  Here is the
> backtrace from the core file:
> 
> ------------------------------ Delimiter BEGIN 
> --------------------------------
> core 'core' of 6419:    ./mutt
>  0007f02c mutt_FormatString (ffbe8ba8, 7f, 0, 69, 2e004, 13f078) + c0
>  0002e4f4 _mutt_copy_message (e30b8, e30a8, 13ec00, 13ec60, 167, 86) + 68
>  0002ea98 mutt_copy_message (ffffffff, 127c58, 13ec00, 167, 86, b0) + 38
>  0006e860 include_reply (0, 13ec00, e30b8, e2af0, e3000, e3400) + a0
>  0006f328 generate_body (ffffffff, 1eaf88, 1, 127c58, 13ec00, ffffff8a) + 25c
>  00070ccc ci_send_message (0, 0, 0, 127c58, 1, 0) + 1344
>  0003547c mutt_index_menu (1, 0, 0, 0, 4, 0) + 3ffc
>  0004ba18 main     (1, ffbea6ec, 0, b9000, 0, e3400) + b5c
>  0001de8c _start   (0, 0, 0, 0, 0, 0) + 5c
> ------------------------------- Delimiter END 
> ---------------------------------
> 
> 
> And below is a gdb session where I set a breakpoint close to the point of
> failure and then single stepped the code until the crash occurred.
> However, the execution flow seems weird so I'm not sure how much value
> to put on the trace.  Note that one change I had to make in the patch
> is that mutt_FormatString() now has an extra arg ('col') and so I pass
> in a zero for that arg.
> 

A quick look at the code shows that col is also missing from
indent_format_str as it was added to format_t. That may be causing the crasheѕ.
Add it there and see how it goes:

--- copy_old.c  2008-01-04 21:04:08.000000000 +0000
+++ copy.c      2008-01-04 21:03:19.000000000 +0000
@@ -511,7 +511,7 @@
 }

 static const char *
-indent_format_str (char *dest, size_t destlen, char op, const char *src,
+indent_format_str (char *dest, size_t destlen, size_t col, char op, const char 
*src,
                   const char *fmt, const char *ifstring, const char 
*elsestring,
                   unsigned long data, format_flag flags)
 {

Best regards.

-- 
Jose Celestino
----------------------------------------------------------------
http://www.msversus.org/     ; http://techp.org/petition/show/1
http://www.vinc17.org/noswpat.en.html
----------------------------------------------------------------
"If you would have your slaves remain docile, teach them hymns."
    -- Ed Weathers ("The Empty Box")