<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>

Greetings,<br><br>I am using the latest stable build, gdal-1.5.1 on a SPARC Solaris 10 64-bit system.&nbsp; It is configured with the default drivers, but is using --with-jpeg=internal --with-libtiff=internal --with-geotiff=internal.&nbsp; Using the 32-bit compiler options and libraries, I can successfully build libgdal.so and the utility programs.&nbsp; However, when trying to do a gdal_translate from one simple uncompressed 3-band geotiff into another simple uncompressed 3-band geotiff, I get a "bus error" segfault.&nbsp; Also, if the output tiff already exists I get two errors. "No space to read tiff directory" and "TiffReadDirectory: failed to read directory at offset 8". A quick google revealed two similiar errors, <a href="http://www.asmail.be/msg0054884489.html">here</a> and <a href="http://osdir.com/ml/video.tiff/2005-08/msg00009.html">here</a>. Diving into the debugger, the problem seems to lie in the tif_dirwrite.c, starting with line 755.&nbsp; I believe it's due to _TIFFmalloc not allocating memory properly. The crash actual occurs on line 781, *(uint32*)n=(uint32)o-&gt;tdir_count;&nbsp; <br><br>o-&gt;tdir_count is valid, but setting n to any value causes a segfault, as though TIFFmalloc did not allocate the whole requested 186 bytes. Any ideas?<br><br>&lt;snip file=tif_dirwrite.c&gt;<br>&nbsp;&nbsp;&nbsp; dirmem=_TIFFmalloc(dirsize);<br>&nbsp;&nbsp;&nbsp; if (dirmem==NULL)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TIFFErrorExt(tif-&gt;tif_clientdata,module,"Out of memory");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto bad;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if (!(tif-&gt;tif_flags&amp;TIFF_BIGTIFF))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; uint8* n;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TIFFDirEntry* o;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n=dirmem;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *(uint16*)n=ndir;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tif-&gt;tif_flags&amp;TIFF_SWAB)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TIFFSwabShort((uint16*)n);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n+=2;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; o=dir;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (m=0; m&lt;ndir; m++)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *(uint16*)n=o-&gt;tdir_tag;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tif-&gt;tif_flags&amp;TIFF_SWAB)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TIFFSwabShort((uint16*)n);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n+=2;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *(uint16*)n=o-&gt;tdir_type;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tif-&gt;tif_flags&amp;TIFF_SWAB)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TIFFSwabShort((uint16*)n);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n+=2;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *(uint32*)n=(uint32)o-&gt;tdir_count;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tif-&gt;tif_flags&amp;TIFF_SWAB)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TIFFSwabLong((uint32*)n);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n+=4;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _TIFFmemcpy(n,&amp;o-&gt;tdir_offset,4);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n+=4;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; o++;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *(uint32*)n = (uint32)tif-&gt;tif_nextdiroff;<br>&nbsp;&nbsp;&nbsp; }<br>&lt;/snip&gt;<br><br>-- Dan Greve<br>-- Software Engineer<br>-- Northrop Grumman Corp.<br><br /><hr />Keep your kids safer online with Windows Live Family Safety. <a href='http://www.windowslive.com/family_safety/overview.html?ocid=TXT_TAGLM_WL_Refresh_family_safety_052008' target='_new'>Help protect your kids.</a></body>
</html>