Core dump converting a TIFF image

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
iznogoud
Posts: 4
Joined: 2014-10-23T08:45:10-07:00
Authentication code: 6789

Core dump converting a TIFF image

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Core dump converting a TIFF image

Post by snibgo »

Please put the image somewhere like dropbox.com and paste the link here.
snibgo's IM pages: im.snibgo.com
iznogoud
Posts: 4
Joined: 2014-10-23T08:45:10-07:00
Authentication code: 6789

Re: Core dump converting a TIFF image

Post by iznogoud »

snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Core dump converting a TIFF image

Post 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?
snibgo's IM pages: im.snibgo.com
JodieC
Posts: 82
Joined: 2014-10-03T21:38:50-07:00
Authentication code: 6789

Re: Core dump converting a TIFF image

Post 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
JodieC
Posts: 82
Joined: 2014-10-03T21:38:50-07:00
Authentication code: 6789

Re: Core dump converting a TIFF image

Post 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.
iznogoud
Posts: 4
Joined: 2014-10-23T08:45:10-07:00
Authentication code: 6789

Re: Core dump converting a TIFF image

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Core dump converting a TIFF image

Post by snibgo »

Yes, to avoid the core dump, I suggest you install the latest version.
snibgo's IM pages: im.snibgo.com
iznogoud
Posts: 4
Joined: 2014-10-23T08:45:10-07:00
Authentication code: 6789

Re: Core dump converting a TIFF image

Post 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
User avatar
Luckboy
Posts: 1
Joined: 2014-10-30T14:02:51-07:00
Authentication code: 6789

Re: Core dump converting a TIFF image

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Core dump converting a TIFF image

Post 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"
Post Reply