Segmentation fault with specific TIFF, 6.5.1-9

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
axelrose
Posts: 96
Joined: 2008-12-16T06:01:27-07:00

Segmentation fault with specific TIFF, 6.5.1-9

Post by axelrose »

Hello,

I did a fresh compilation of 6.5.1-9 using libtiff 3.8.2 because a simple convert for a specific TIFF input failed
with 6.4.x

This is from Apple's CrashReporter:
---
Process: convert [50654]
Path: /usr/local/share/imagemagick/bin/convert
Identifier: convert
Version: ??? (???)
Code Type: X86 (Native)
Parent Process: bash [3293]

Date/Time: 2009-04-30 16:34:06.318 +0200
OS Version: Mac OS X 10.5.6 (9G55)
Report Version: 6

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000060000000
Crashed Thread: 0

Thread 0 Crashed:
0 libtiff.3.dylib 0x0008096a _TIFFVGetField + 1226
1 libtiff.3.dylib 0x00080f42 TIFFGetField + 34
2 tiff.so 0x007b0cea ReadTIFFImage + 6426 (tiff.c:433)
3 libMagickCore.2.dylib 0x0029f1c7 ReadImage + 3447 (constitute.c:573)
4 libMagickCore.2.dylib 0x0029f7b2 ReadImages + 338 (constitute.c:897)
5 libMagickWand.2.dylib 0x004ef050 ConvertImageCommand + 12848 (convert.c:569)
6 convert 0x00001eac main + 572 (convert.c:123)
7 convert 0x00001c36 start + 54
(more)
---

This is what I see if I run "convert -debug all /tmp/test.tif /tmp/test.jpg":
---
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: utility.c/ExpandFilenames/826/Configure
Command line: /usr/local/share/imagemagick/bin/convert {-debug} {all} {/tmp/test.tif} {/tmp/test.jpg}
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/config/coder.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/lib/ImageMagick-6.5.1/config/coder.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/share/doc/ImageMagick-6.5.1/coder.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/coder.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/Users/me/.magick/coder.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "coder.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: coder.c/LoadCoderList/638/Configure
Loading coder configuration file "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/config/coder.xml" ...
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Module convert[50858]: module.c/OpenModule/1144/Module
Searching for module "TIFF" using filename "tiff.la"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Module convert[50858]: module.c/GetMagickModulePath/549/Module
Searching for coder module file "tiff.la" ...
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Module convert[50858]: module.c/OpenModule/1153/Module
Opening module at path "/usr/local/share/imagemagick/lib/ImageMagick-6.5.1/modules-Q16/coders/tiff.la"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Module convert[50858]: module.c/OpenModule/1180/Module
Method "RegisterTIFFImage" in module "TIFF" at address 0x7aedc0
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Module convert[50858]: module.c/OpenModule/1194/Module
Method "UnregisterTIFFImage" in module "TIFF" at address 0x7af030
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Blob convert[50858]: blob.c/OpenBlob/2367/Blob
read 3 magic header bytes
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Cache convert[50858]: cache.c/DestroyPixelCacheInfo/1513/Cache
destroy
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/config/magic.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/lib/ImageMagick-6.5.1/config/magic.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/share/doc/ImageMagick-6.5.1/magic.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/magic.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "/Users/me/.magick/magic.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: configure.c/GetConfigureOptions/528/Configure
Searching for configure file: "magic.xml"
2009-04-30T16:51:21+02:00 0:01 0.000u 6.5.1 Configure convert[50858]: magic.c/LoadMagicList/682/Configure
Loading magic configure file "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/config/magic.xml" ...
2009-04-30T16:51:21+02:00 0:01 0.010u 6.5.1 Blob convert[50858]: blob.c/OpenBlob/2367/Blob
read 3 magic header bytes
2009-04-30T16:51:21+02:00 0:01 0.010u 6.5.1 Cache convert[50858]: cache.c/DestroyPixelCacheInfo/1513/Cache
destroy
2009-04-30T16:51:21+02:00 0:01 0.010u 6.5.1 Blob convert[50858]: blob.c/OpenBlob/2367/Blob
read 3 magic header bytes
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Coder convert[50858]: tiff.c/ReadTIFFImage/696/Coder
Geometry: 1899x1644
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Coder convert[50858]: tiff.c/ReadTIFFImage/698/Coder
Interlace: 1
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Coder convert[50858]: tiff.c/ReadTIFFImage/700/Coder
Bits per sample: 8
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Coder convert[50858]: tiff.c/ReadTIFFImage/702/Coder
Min sample value: 0
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Coder convert[50858]: tiff.c/ReadTIFFImage/704/Coder
Max sample value: 255
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Coder convert[50858]: tiff.c/ReadTIFFImage/740/Coder
Photometric: SEPARATED
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Resource convert[50858]: resource.c/AcquireMagickResource/221/Resource
Area: 23.82mb/23.82mb/4gb
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Resource convert[50858]: resource.c/AcquireMagickResource/221/Resource
Memory: 23.82mb/23.82mb/3gb
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Cache convert[50858]: cache.c/OpenPixelCache/3832/Cache
open /tmp/test.tif[0] (heap memory, 1899x1644 23.82mb)
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Coder convert[50858]: tiff.c/ReadTIFFImage/759/Coder
Image depth: 8
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Locale convert[50858]: locale.c/GetLocaleOptions/498/Locale
Searching for locale file: "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/config/locale.xml"
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Locale convert[50858]: locale.c/GetLocaleOptions/498/Locale
Searching for locale file: "/usr/local/share/imagemagick/lib/ImageMagick-6.5.1/config/locale.xml"
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Locale convert[50858]: locale.c/GetLocaleOptions/498/Locale
Searching for locale file: "/usr/local/share/imagemagick/share/doc/ImageMagick-6.5.1/locale.xml"
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Locale convert[50858]: locale.c/GetLocaleOptions/498/Locale
Searching for locale file: "/usr/local/share/imagemagick/share/ImageMagick-6.5.1/locale.xml"
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Locale convert[50858]: locale.c/GetLocaleOptions/498/Locale
Searching for locale file: "/Users/me/.magick/locale.xml"
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Locale convert[50858]: locale.c/GetLocaleOptions/498/Locale
Searching for locale file: "locale.xml"
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Configure convert[50858]: locale.c/LoadLocaleList/779/Configure
Loading locale configure file "/usr/local/share/imagemagick/lib/ImageMagick-6.5.1/config/locale.xml" ...
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Configure convert[50858]: locale.c/LoadLocaleList/779/Configure
Loading locale configure file "/usr/local/share/imagemagick/lib/ImageMagick-6.5.1/config/english.xml" ...
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Exception convert[50858]: tiff.c/TIFFWarnings/525/Exception
/tmp/test.tif: unknown field with tag 40961 (0xa001) encountered. `TIFFReadCustomDirectory'
2009-04-30T16:51:21+02:00 0:01 0.020u 6.5.1 Exception convert[50858]: tiff.c/TIFFWarnings/525/Exception
/tmp/test.tif: wrong data type 3 for "GainControl"; tag ignored. `TIFFReadCustomDirectory'
---

I'm working under MacOS X 10.5.6. "gdb" would be available. I just can't find a core file.

Is there any chance for help?

Regards,
Axel
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Segmentation fault with specific TIFF, 6.5.1-9

Post by magick »

The bug appears to be in the TIFF delegate library in method TIFFVGetField(). Can you post a URL to your TIFF image so we can see if we can read it on our Linux / Apple / Windows boxes?
axelrose
Posts: 96
Joined: 2008-12-16T06:01:27-07:00

Re: Segmentation fault with specific TIFF, 6.5.1-9

Post by axelrose »

Please send me a private note where to upload the image.

I crosschecked with "exiftool". No warning or error from there.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Segmentation fault with specific TIFF, 6.5.1-9

Post by magick »

We do not accept uploads, only downloads. You can send a PM with the URL if you want to keep the location private.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Segmentation fault with specific TIFF, 6.5.1-9

Post by magick »

Your image loaded without complaint on our Linux box. We're using ImageMagick 6.5.1-10 and TIFF 3.8.2. We will try under Mac OS X later.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Segmentation fault with specific TIFF, 6.5.1-9

Post by magick »

We do not have the original TIFF image. We'll need a URL so we can download the image and reproduce the fault. Thanks.
axelrose
Posts: 96
Joined: 2008-12-16T06:01:27-07:00

Re: Segmentation fault with specific TIFF, 6.5.1-9

Post by axelrose »

Does ImageMagick compile with a newer version of libtiff (3.9beta, 4.0beta)?

Regards
Axel
Post Reply