Bug 2555 - att_remover plugin crash case
Summary: att_remover plugin crash case
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Other (show other bugs)
Version: 3.7.10
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2011-12-01 11:02 UTC by J
Modified: 2011-12-29 14:26 UTC (History)
0 users

See Also:


Attachments
probable fix (4.05 KB, patch)
2011-12-02 22:54 UTC, Pawel Pekala
no flags Details | Diff

Description J 2011-12-01 11:02:38 UTC
Hi.

I have this email with three attached files.

Removing all of them at once using att_remover plugin makes claws-mail crash systematically. Removing them seperately works.


---------------------------------------------------------------

Program received signal SIGSEGV, Segmentation fault.
0x00007fffe85ef641 in ?? () from /usr/lib/claws-mail/plugins/att_remover.so
(gdb) thread apply all bt

Thread 2 (Thread 0x7fffea7d9700 (LWP 28593)):
#0  0x00007ffff545d2c4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff48006eb in mailsem_internal_wait () from /usr/lib/libetpan.so.15
#2  0x00000000005e7069 in thread_run (data=0xdcdc80) at etpan-thread-manager.c:324
#3  0x00007ffff5458b40 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff426036d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7fc49a0 (LWP 28590)):
#0  0x00007fffe85ef641 in ?? () from /usr/lib/claws-mail/plugins/att_remover.so
#1  0x00007ffff5211804 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#2  0x00007ffff522378a in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3  0x00007ffff522ce11 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4  0x00007ffff522cfb2 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5  0x00007ffff73f0dc5 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#6  0x00007ffff5211804 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7  0x00007ffff5222f7a in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8  0x00007ffff522ce11 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9  0x00007ffff522cfb2 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007ffff73efbed in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#11 0x00007ffff7499418 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#12 0x00007ffff5211804 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007ffff52235bf in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007ffff522cbe3 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff522cfb2 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007ffff75b2301 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#17 0x00007ffff74975d3 in gtk_propagate_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#18 0x00007ffff7497933 in gtk_main_do_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#19 0x00007ffff710321c in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#20 0x00007ffff4d4c0cf in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007ffff4d4c8c8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007ffff4d4ce02 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007ffff7496987 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#24 0x000000000044c0c8 in main (argc=1, argv=0x7fffffffe828) at main.c:1681

---------------------------------------------------------------


Just before the crash :


imap.c:1416:trying to fetch cached /home/jerome/.claws-mail/imapcache/domain/account/dir/subdir/964
imap.c:1425:message 964 has been already fully cached.
    message/rfc822 (offset:0 length:3363613 encoding: 6)
        multipart/mixed (offset:1538 length:3362075 encoding: 6)
            multipart/alternative (offset:1709 length:1160892 encoding: 6)
                text/plain (offset:1842 length:568 encoding: 1)
                multipart/related (offset:2533 length:1160026 encoding: 6)
                    text/html (offset:2650 length:1338 encoding: 0)
                    image/png (offset:4137 length:1158380 encoding: 4)
            application/pdf (offset:1162824 length:2200747 encoding: 4)
imap.c:1416:trying to fetch cached /home/jerome/.claws-mail/imapcache/domain/account/dir/subdir/964
imap.c:1425:message 964 has been already fully cached.
    message/rfc822 (offset:0 length:3363613 encoding: 6)
        multipart/mixed (offset:1538 length:3362075 encoding: 6)
            multipart/alternative (offset:1709 length:1160892 encoding: 6)
                text/plain (offset:1842 length:568 encoding: 1)
                multipart/related (offset:2533 length:1160026 encoding: 6)
                    text/html (offset:2650 length:1338 encoding: 0)
                    image/png (offset:4137 length:1158380 encoding: 4)
            application/pdf (offset:1162824 length:2200747 encoding: 4)
imap.c:1416:trying to fetch cached /home/jerome/.claws-mail/imapcache/domain/account/dir/subdir/964
imap.c:1425:message 964 has been already fully cached.
    message/rfc822 (offset:0 length:3363613 encoding: 6)
        multipart/mixed (offset:1538 length:3362075 encoding: 6)
            multipart/alternative (offset:1709 length:1160892 encoding: 6)
                text/plain (offset:1842 length:568 encoding: 1)
                multipart/related (offset:2533 length:1160026 encoding: 6)
                    text/html (offset:2650 length:1338 encoding: 0)
                    image/png (offset:4137 length:1158380 encoding: 4)
            application/pdf (offset:1162824 length:2200747 encoding: 4)
att_remover.c:174:called inc_lock (lock count 1)


Program received signal SIGSEGV, Segmentation fault.
0x00007fffe85ef641 in ?? () from /usr/lib/claws-mail/plugins/att_remover.so


---------------------------------------------------------------


FWIF, here's the structure of the message :


Content-Type: multipart/mixed;
 boundary="------------040408070706010509050800"

This is a multi-part message in MIME format.
--------------040408070706010509050800
Content-Type: multipart/alternative;
 boundary="------------090105080802090309080202"


--------------090105080802090309080202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


[...]  Text


--------------090105080802090309080202
Content-Type: multipart/related;
 boundary="------------000103040906030202050305"


--------------000103040906030202050305
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

[...] html


--------------000103040906030202050305
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-ID: <part1.07030602.02050309@laposte.net>

[...]

--------------000103040906030202050305--

--------------090105080802090309080202--

--------------040408070706010509050800
Content-Type: application/pdf;
 name="the_name_of_the_file.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="the_name_of_the_file.pdf"

[...]

--------------040408070706010509050800--


---------------------------------------------------------------


Not sur the trace is enough. I installed and used claws-mail-dbg but I didn't find any debug package for the plugin.


I built (but did not install) the CVS version of claws-mail but I couldn't build the plugin :

configure: error: Package requirements (claws-mail >= 3.6.1.27) were not met:

No package 'claws-mail' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables CLAWS_MAIL_CFLAGS
and CLAWS_MAIL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

I didn't know what to do after that.

Therefore, the trace I provided is made with packaged version.

Feel free to ask for more details. This is 100% reproducible.
Comment 1 Pawel Pekala 2011-12-02 22:54:25 UTC
Created attachment 1045 [details]
probable fix

Does this patch helps?
Comment 2 Pawel Pekala 2011-12-03 12:10:31 UTC
As for your build problems, I use script below to build plugins
from cvs, just run it instead of autogen.sh

CLAWS_DIR should point to your claws-mail cvs checkout and
PREFIX probably should be /usr on your system

Also set configure prefix option to your desired destination for binaries
and you should be set ;-)

#!/bin/sh

CLAWS_DIR="/home/corn/projects/claws"
PREFIX="/usr/local"

CFLAGS="-I$PREFIX/include -I$PREFIX/include/gpgme -I$CLAWS_DIR -I$CLAWS_DIR/src"
CFLAGS="$CFLAGS -I$CLAWS_DIR/src/common -I$CLAWS_DIR/src/gtk"

export LDFLAGS="-L$PREFIX/lib"
export CLAWS_MAIL_CFLAGS="$CFLAGS"

aclocal \
  && libtoolize --copy --force \
  && autoheader \
  && automake --add-missing --foreign --copy \
  && autoconf \
  && ./configure --enable-maintainer-mode \
  	--with-libiconv-prefix=$PREFIX \
  	--with-libintl-prefix=$PREFIX \
  	--prefix=/home/corn/test $@
Comment 3 J 2011-12-05 08:53:46 UTC
Hi.

Indeed, the patch fixes the issue. Congratulations.

Thanks for your build script. Actually, I had this error because I had not "make install"ed claws-mail, I was testing it from its build directory. Installing it solves that and the autogen.sh works. 

Besides, I couldn't use att_remover on the cvs version of claws-mail : it complained that it was compiled for an older version. I tested it on my packaged claws-mail installation. 

Anyway, it worked.
Comment 4 Colin Leroy 2011-12-05 08:57:05 UTC
Thanks Pawel,

Feel free to commit :)
Comment 5 Colin Leroy 2011-12-29 14:26:06 UTC
2011-12-05 [pawel]      1.0.12cvs1

        * commitHelper
                Support bash not in /bin 
        * src/att_remover.c
                Split removal of attachments to 2 phases, first remove
                selected attachments and in second phase remove uneeded
                multipart leftovers. This allows us to avoid crashers and
                leave more sane MIME structure afterwards.
                Fixes bug #2555 'att_remover plugin crash case'

Note You need to log in before you can comment on or make changes to this bug.