Page 1 of 1

Core dump converting a TIFF image

Posted: 2014-10-23T08:52:50-07:00
by iznogoud
Hello,

Currently writing a PHP software I got a core dump on '$image = new Imagick($fullFileName);' instruction.

I tried to directly use 'convert" on the same picture:
# convert image.tif image.jpg
Segmentation fault (core dumped)

This is a valid TIFF image (I'm able to open it using Paint, The Gimp, etc.).

How can I help find a fix for this bug?

Re: Core dump converting a TIFF image

Posted: 2014-10-23T09:14:30-07:00
by snibgo
Please put the image somewhere like dropbox.com and paste the link here.

Re: Core dump converting a TIFF image

Posted: 2014-10-23T09:30:53-07:00
by iznogoud

Re: Core dump converting a TIFF image

Posted: 2014-10-23T10:17:12-07:00
by snibgo
Exiftool says: " ExifTool:Warning='Bad ExifIFD directory'"

IM identify says:

Code: Select all

aa.tif TIFF 3693x1946 3693x1946+0+0 8-bit sRGB 256c 7.213MB 0.016u 0:00.015
identify.exe: Sanity check on directory count failed, this is probably not a valid IFD offset. `TIFFFetchDirectory' @ error/tiff.c/TIFFErrors/561.
identify.exe: Failed to read custom directory at offset 7206312. `TIFFReadCustomDirectory' @ error/tiff.c/TIFFErrors/561.
A developer would need to take a look.

EDIT: My test above is with IM v6.8.9-5. I suspect this isn't an IM bug, but an error in the file. Some software tolerates some errors. IM is quite strict.

IM shouldn't dump core. Are you using an old version of IM?

Re: Core dump converting a TIFF image

Posted: 2014-10-23T10:28:55-07:00
by JodieC
in ubuntu 14.04 amd64 with imagemagick-6.7.7.10:

Code: Select all

ReadTIFFImage (image_info=0x60dbd0, exception=0x605610) at coders/tiff.c:1261
1261	              image->colormap[i].green=ClampToQuantum(((double) QuantumRange*
gdb$ context
--------------------------------------------------------------------------[regs]
  EAX: 0x006DF5A8  EBX: 0xFFFF5850  ECX: 0x0062FF10  EDX: 0x00000000  o d I t s z a p C 
  ESI: 0x00000000  EDI: 0x00605390  EBP: 0xFFFF5848  ESP: 0xFFFF56B0  EIP: 0xValue can't be converted to integer.
gdb$ bt
#0  ReadTIFFImage (image_info=0x60dbd0, exception=0x605610) at coders/tiff.c:1261
#1  0x00007ffff79ba936 in ReadImage (image_info=image_info@entry=0x609a30, exception=exception@entry=0x605610) at magick/constitute.c:590
#2  0x00007ffff79bae9b in ReadImages (image_info=image_info@entry=0x609a30, exception=exception@entry=0x605610) at magick/constitute.c:901
#3  0x00007ffff7665f8e in ConvertImageCommand (image_info=0x609a30, argc=0x3, argv=0x605650, metadata=0x0, exception=0x605610) at wand/convert.c:601
#4  0x00007ffff76cf79a in MagickCommandGenesis (image_info=image_info@entry=0x605890, command=0x400810 <ConvertImageCommand@plt>, argc=argc@entry=0x3, argv=argv@entry=0x7fffffffdf58, metadata=metadata@entry=0x0, exception=exception@entry=0x605610) at wand/mogrify.c:161
#5  0x0000000000400887 in ConvertMain (argv=0x7fffffffdf58, argc=0x3) at utilities/convert.c:81
#6  main (argc=0x3, argv=0x7fffffffdf58) at utilities/convert.c:92
ReadTIFFImage (image_info=0x60dbd0, exception=0x605610) at coders/tiff.c:1261
1261	              image->colormap[i].green=ClampToQuantum(((double) QuantumRange*
gdb$ context
--------------------------------------------------------------------------[regs]
  EAX: 0x006DF5A8  EBX: 0xFFFF5850  ECX: 0x0062FF10  EDX: 0x00000000  o d I t s z a p C 
  ESI: 0x00000000  EDI: 0x00605390  EBP: 0xFFFF5848  ESP: 0xFFFF56B0  EIP: 0xValue can't be converted to integer.
gdb$ bt
#0  ReadTIFFImage (image_info=0x60dbd0, exception=0x605610) at coders/tiff.c:1261
#1  0x00007ffff79ba936 in ReadImage (image_info=image_info@entry=0x609a30, exception=exception@entry=0x605610) at magick/constitute.c:590
#2  0x00007ffff79bae9b in ReadImages (image_info=image_info@entry=0x609a30, exception=exception@entry=0x605610) at magick/constitute.c:901
#3  0x00007ffff7665f8e in ConvertImageCommand (image_info=0x609a30, argc=0x3, argv=0x605650, metadata=0x0, exception=0x605610) at wand/convert.c:601
#4  0x00007ffff76cf79a in MagickCommandGenesis (image_info=image_info@entry=0x605890, command=0x400810 <ConvertImageCommand@plt>, argc=argc@entry=0x3, argv=argv@entry=0x7fffffffdf58, metadata=metadata@entry=0x0, exception=exception@entry=0x605610) at wand/mogrify.c:161
#5  0x0000000000400887 in ConvertMain (argv=0x7fffffffdf58, argc=0x3) at utilities/convert.c:81
#6  main (argc=0x3, argv=0x7fffffffdf58) at utilities/convert.c:92
rax            0x6df5a8	0x6df5a8
rbx            0x7fffffff5850	0x7fffffff5850
rcx            0x62ff10	0x62ff10
rdx            0x0	0x0
rsi            0x0	0x0
rdi            0x605390	0x605390
rbp            0x7fffffff5848	0x7fffffff5848
rsp            0x7fffffff56b0	0x7fffffff56b0
r8             0x100	0x100
r9             0x6441	0x6441
r10            0x7fffffff5460	0x7fffffff5460
r11            0x7ffff54814f0	0x7ffff54814f0
r12            0x0	0x0
r13            0x620070	0x620070
r14            0x65d200	0x65d200
r15            0x1	0x1
rip            0x7ffff37c78c8	0x7ffff37c78c8 <ReadTIFFImage+10888>
eflags         0x10203	[ CF IF RF ]
cs             0x33	0x33
ss             0x2b	0x2b
ds             0x0	0x0
es             0x0	0x0
fs             0x0	0x0
gs             0x0	0x0

Re: Core dump converting a TIFF image

Posted: 2014-10-23T10:30:41-07:00
by JodieC
Errors properly on a self-compiled IM 6.8.9-8 on Ubuntu 14.04 amd64

Code: Select all

~/ImageMagick-6.8.9-8/utilities$ ./convert ~/Downloads/aa.tif png:/dev/null
lt-convert: Sanity check on directory count failed, this is probably not a valid IFD offset. `TIFFFetchDirectory' @ error/tiff.c/TIFFErrors/561.
lt-convert: Failed to read custom directory at offset 7206312. `TIFFReadCustomDirectory' @ error/tiff.c/TIFFErrors/561.

Re: Core dump converting a TIFF image

Posted: 2014-10-28T08:33:32-07:00
by iznogoud
snibgo wrote: EDIT: My test above is with IM v6.8.9-5. I suspect this isn't an IM bug, but an error in the file. Some software tolerates some errors. IM is quite strict.

IM shouldn't dump core. Are you using an old version of IM?
JodieC wrote:Errors properly on a self-compiled IM 6.8.9-8 on Ubuntu 14.04 amd64
I'm running a 6.7.7-10 2014-03-06 Q16 version (installed using apt-get on Ubuntu 14.04.1 LTS).

Am I right when I think that I should self-compile the latest version?

Re: Core dump converting a TIFF image

Posted: 2014-10-28T08:49:32-07:00
by snibgo
Yes, to avoid the core dump, I suggest you install the latest version.

Re: Core dump converting a TIFF image

Posted: 2014-10-28T10:25:52-07:00
by iznogoud
snibgo wrote:Yes, to avoid the core dump, I suggest you install the latest version.
OK, I'll try in a couple of weeks.

Thanks for the help,
Georges

Re: Core dump converting a TIFF image

Posted: 2014-10-30T14:18:11-07:00
by Luckboy
I'm running into the same problem. I'm converting a multipage TIF file from color to grayscale with the following command:

Code: Select all

convert -colorspace Gray -density 300 -compress lzw -depth 8 "Z:\Source\4201334562-20120728-20130515.tif" "Z:\Output\4201334562-20120728-20130515.tif"
And I get the error:

Code: Select all

convert.exe: Unknown field with tag 37680 (0x9330) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/857.
convert.exe: Unknown field with tag 40094 (0x9c9e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/857.
convert.exe: Unknown field with tag 59932 (0xea1c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/857.
convert.exe: Sanity check on directory count failed, this is probably not a valid IFD offset. `TIFFFetchDirectory' @ error/tiff.c/TIFFErrors/561.
convert.exe: Failed to read custom directory at offset 2365828. `TIFFReadCustomDirectory' @ error/tiff.c/TIFFErrors/561.
convert.exe: Unknown field with tag 40094 (0x9c9e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/857.
convert.exe: Unknown field with tag 59932 (0xea1c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/857.
' and output of '
C:\>convert -colorspace Gray -density 300 -compress lzw -depth 8 "Z:\Source\4201334562-20120728-20130515.tif" "Z:\Output\4201334562-20120728-20130515.tif"
Any ideas?

Re: Core dump converting a TIFF image

Posted: 2014-10-30T16:15:10-07:00
by fmw42
First your syntax is not truly IM 6 style. The input tiff should be read first. see http://www.imagemagick.org/Usage/basics/#cmdline


Most of you text is warnings that the TIFF file has meta fields that IM does not support. Tiff allows users to add lots of private meta fields. To turn that off add -quiet to your command. Try

Code: Select all

convert -quiet "Z:\Source\4201334562-20120728-20130515.tif" -colorspace Gray -density 300 -compress lzw -depth 8 "Z:\Source\4201334562-20120728-20130515.tif" "Z:\Output\4201334562-20120728-20130515.tif"