#2882: segfaults in uxterm with > 254 columns if there are single byte 8-bit characters in index_format
{{{ ----- Forwarded message from Axel Beckert <[EMAIL PROTECTED]> ----- Date: Mon, 23 Apr 2007 15:08:27 +0200 (CEST) From: Axel Beckert <[EMAIL PROTECTED]> Reply-To: Axel Beckert <[EMAIL PROTECTED]>, [EMAIL PROTECTED] To: Debian Bug Tracking System <[EMAIL PROTECTED]> Subject: Bug#420598: mutt: segfaults in uxterm with > 254 columns if there are single byte 8-bit characters in index_format Package: mutt Version: 1.5.9-2sarge2 Severity: normal Since a long time, my index_format for mutt is set as follows: set index_format="%4C %Z %[%a·%d·%b] %-16.16F [%-12.12L] (%4c %4l) %s%> %M" It works fine since years and even inside uxterms with LC_CTYPE=en_US.UTF-8, but no other locale environment variables set. To track down the problem, I used a .muttrc only containing the above line. If I now resize the uxterm with an running mutt inside to more than 254 columns of if I start mutt inside such an uxterm with more than 254 columns, mutt segfaults. It does not happen inside an xterm (same configuration). Although mutt shows only 255 (but not 254 as I would have expected) columns of content in there. (Probably a mutt internal limit.) The segfault also does not happen if I replace the two occurences of "·" with "-", but a segfault shouldn't happen anyway. How to reproduce: ================= Write the following line as only line into $HOME/.muttrc with iso8859-1 charset: set index_format="%4C %Z %[%a·%d·%b] %-16.16F [%-12.12L] (%4c %4l) %s%> %M" Then, on a display with (at least) 1600x1200 resolution, open an uxterm with the font "fixed", e.g. by calling "uxterm -fn fixed". Maximise that window -- at least horizontally. Depending on the window managers border width (fvwm2 with 3px borders here) the uxterm should have around 260 columns. Check that with e.g. typing "echo $COLUMNS". Then start mutt in a nearly virgin environment: env -i LC_CTYPE=en_US.UTF-8 USER=$USER HOME=$HOME TERM=xterm mutt mutt will segfault when trying to display the mail index. -- System Information: Debian Release: 3.1 Architecture: i386 (i686) Kernel: Linux 2.4.33.2-1-dphys-k8-smp-64gb Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages mutt depends on: ii libc6 2.3.2.ds1-22sarge6 GNU C Library: Shared libraries an ii libdb4.3 4.3.27-2 Berkeley v4.3 Database Libraries [ ii libgnutls11 1.0.16-13.2sarge2 GNU TLS library - runtime library ii libidn11 0.5.13-1.0 GNU libidn library, implementation ii libncursesw5 5.4-4 Shared libraries for terminal hand ii libsasl2 2.1.19.dfsg1-0sarge2 Authentication abstraction library ii postfix [mail-trans 2.1.5-9 A high-performance mail transport -- no debconf information ----- End forwarded message ----- I can reproduce the bug with current tip with an utf8-encoded muttrc: set index_format="%4C %Z %[%a·%d·%b] %-16.16F [%-12.12L] (%4c %4l) %s%> %M" xterm, utf8, 253 columns. Sorting mailbox... Program received signal SIGSEGV, Segmentation fault. 0x0000000000484049 in mutt_FormatString (dest=0x7fff965fbae0 " 279 Wed·28·Feb Sebastian Schöni [Sebastian Sc] (1,0K 28) Einladung �200 \236Bad-Taste-Party�200\234", ' ' <repeats 102 times>..., destlen=255, col=253, src=0x91a7f8 "%M", callback=0x4389a1 <hdr_format_str>, data=140735716243968, flags=100) at muttlib.c:1221 1221 memcpy (wptr, buf, len); (gdb) bt #0 0x0000000000484049 in mutt_FormatString (dest=0x7fff965fbae0 " 279 Wed·28·Feb Sebastian Schöni [Sebastian Sc] (1,0K 28) Einladung �200 \236Bad-Taste-Party�200\234", ' ' <repeats 102 times>..., destlen=255, col=253, src=0x91a7f8 "%M", callback=0x4389a1 <hdr_format_str>, data=140735716243968, flags=100) at muttlib.c:1221 #1 0x000000000043a4cb in _mutt_make_string (dest=0x7fff965fbae0 " 279 Wed·28·Feb Sebastian Schöni [Sebastian Sc] (1,0K 28) Einladung �200 \236Bad-Taste-Party�200\234", ' ' <repeats 102 times>..., destlen=256, s=0x91a7c0 "%4C %Z %[%a·%d·%b] %-16.16F [%-12.12L] (%4c %4l) %s%> %M", ctx=0x91c570, hdr=0x9a0ab0, flags=100) at hdrline.c:736 #2 0x000000000041d4f3 in index_make_entry (s=0x7fff965fbae0 " 279 Wed·28·Feb Sebastian Schöni [Sebastian Sc] (1,0K 28) Einladung �200 \236Bad-Taste-Party�200\234", ' ' <repeats 102 times>..., l=256, menu=0x9c1c10, num=278) at curs_main.c:174 #3 0x0000000000443666 in menu_make_entry (s=0x7fff965fbae0 " 279 Wed·28·Feb Sebastian Schöni [Sebastian Sc] (1,0K 28) Einladung �200 \236Bad-Taste-Party�200\234", ' ' <repeats 102 times>..., l=256, menu=0x9c1c10, i=278) at menu.c:154 #4 0x000000000044395c in menu_redraw_index (menu=0x9c1c10) at menu.c:216 Christoph }}} -- Ticket URL: <http://dev.mutt.org/trac/ticket/2882>