Page 1 of 1

Segmentation fault in convert on linux/amd64

Posted: 2010-10-02T06:23:14-07:00
by vl409

Code: Select all

$ convert algo.tif algo.jpg
Segmentation fault
$ convert -version
Version: ImageMagick 6.6.2-5 2010-09-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP OpenCL 
System:

Code: Select all

$ emerge --info
Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11.2-r0, 2.6.31-gentoo-r6 x86_64)
=================================================================
System uname: Linux-2.6.31-gentoo-r6-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8500_@_3.16GHz-with-gentoo-2.0.1
Timestamp of tree: Fri, 24 Sep 2010 20:15:01 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.5.4-r3, 2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.4_p6-r1, 1.5, 1.7.9-r2, 1.8.5-r3, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       3.4.6-r2, 4.1.2, 4.3.4, 4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
Tiff image leading to segfault and core file are here: http://depositfiles.com/ru/files/1353jtvg1 (sorry for ads, but don't see how to attach files here)

Note: GIMP also fails to load the image complaining it contains some outdated features.
The image was produced by one of microsoft products.

Re: Segmentation fault in convert on linux/amd64

Posted: 2010-10-02T07:30:18-07:00
by Drarakel
I have no problem with that file - with IM v6.6.4-8 Q16 (on Windows). So, my advice would be to update ImageMagick. There were a few patches for such TIFF files lately. It could also depend on the libtiff version on your system (with the Windows distributions, libtiff v3.9.2 is used).

Re: Segmentation fault in convert on linux/amd64

Posted: 2010-10-03T06:38:03-07:00
by vl409
I have no problem with that file - with IM v6.6.4-8 Q16 (on Windows). So, my advice would be to update ImageMagick. There were a few patches for such TIFF files lately. It could also depend on the libtiff version on your system (with the Windows distributions, libtiff v3.9.2 is used).
with latest version

Code: Select all

$ /opt/imm/bin/convert --version
Version: ImageMagick 6.6.4-8 2010-10-03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenM
result is the same. Libtiff is 3.9.4

Code: Select all

$ ldd /opt/imm/bin/convert|grep tif
	libtiff.so.3 => /usr/lib/libtiff.so.3 (0x00007f024d071000)
$ ls -l /usr/lib/libtiff.so.3
lrwxrwxrwx 1 root root 16 Jun 28 00:24 /usr/lib/libtiff.so.3 -> libtiff.so.3.9.4
Debugger shows that it really fails somewhere in libtiff. I had to check it first.

Re: Segmentation fault in convert on linux/amd64

Posted: 2010-10-03T09:57:03-07:00
by Drarakel
OK, seems that the latest IM patches didn't change these general problems. (You're not the only one with such errors - see e.g. here.) It really seems to be a libtiff issue.
I guess libtiff has to be compiled with special switches so that it can still read the 'Old JPEG' in TIFF compression. Can't give you more specific hints - I'm just a Windows user and don't have these problems. (The Windows IM/libtiff distribution can read most of these files right from the start.)

Re: Segmentation fault in convert on linux/amd64

Posted: 2010-10-03T13:13:44-07:00
by vl409
Can't give you more specific hints - I'm just a Windows user and don't have these problems. (The Windows IM/libtiff distribution can read most of these files right from the start.)
I've tried to recompile libtiff without --disable-old-jpeg flag, but got no effect.

It looks like the problem is not 'old jpeg' stuff, but a bug somewhere in a library - maybe it's 64 bits-related. Since gimp (using same libtiff) can complain about unsupported 'old jpeg' stuff this means library is robust enough to report some incompatibility. But segfault is not an expected behaviour.

Below is backtrace if you are interesetd. I guess this bug should be reported against libtiff.

Code: Select all

(gdb) run algo.tif algo2.png
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6eaf33a in putcontig8bitYCbCr22tile (img=0x7fffffff6280, cp=<value optimized out>, x=<value optimized out>, y=<value optimized out>, w=<value optimized out>, h=<value optimized out>, fromskew=0, toskew=<value optimized out>, pp=0x7fffe991ed20 "\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377"...) at tif_getimage.c:1857
	in tif_getimage.c
(gdb) backtrace
#0  0x00007ffff6eaf33a in putcontig8bitYCbCr22tile (img=0x7fffffff6280, cp=<value optimized out>, x=<value optimized out>, y=<value optimized out>, w=<value optimized out>, h=<value optimized out>, fromskew=0, toskew=<value optimized out>, pp=0x7fffe991ed20 "\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377\377\377\200\200\377\377"...) at tif_getimage.c:1857
#1  0x00007ffff6eb1128 in gtStripContig (img=0x7fffffff6280, raster=<value optimized out>, w=<value optimized out>, h=3508) at tif_getimage.c:840
#2  0x00007ffff6eb35bf in TIFFReadRGBAImageOriented (tif=0x65a240, rwidth=2480, rheight=<value optimized out>, raster=0x7fffea58f010, orientation=4, stop=<value optimized out>) at tif_getimage.c:480
#3  0x00007ffff7a51577 in ReadTIFFImage (image_info=0x610680, exception=0x607d80) at coders/tiff.c:1549
#4  0x00007ffff77e9646 in ReadImage (image_info=0x60c480, exception=<value optimized out>) at magick/constitute.c:578
#5  0x00007ffff77e9b4b in ReadImages (image_info=0x60c480, exception=0x607d80) at magick/constitute.c:883
#6  0x00007ffff73a1eb7 in ConvertImageCommand (image_info=0x60c480, argc=3, argv=0x606dd0, metadata=0x0, exception=0x607d80) at wand/convert.c:581
#7  0x00007ffff746c5b3 in MagickCommandGenesis (image_info=0x608280, command=0x400b18 <ConvertImageCommand@plt>, argc=3, argv=0x7fffffffdcd8, metadata=0x0, exception=0x607d80) at wand/mogrify.c:165
#8  0x0000000000400caf in main (argc=3, argv=0x7fffffffdcd8) at utilities/convert.c:80