<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. It is configured with the default drivers, but is using --with-jpeg=internal --with-libtiff=internal --with-geotiff=internal. Using the 32-bit compiler options and libraries, I can successfully build libgdal.so and the utility programs. 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. 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. I believe it's due to _TIFFmalloc not allocating memory properly. The crash actual occurs on line 781, *(uint32*)n=(uint32)o->tdir_count; <br><br>o->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><snip file=tif_dirwrite.c><br> dirmem=_TIFFmalloc(dirsize);<br> if (dirmem==NULL)<br> {<br> TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");<br> goto bad;<br> }<br> if (!(tif->tif_flags&TIFF_BIGTIFF))<br> {<br> uint8* n;<br> TIFFDirEntry* o;<br> n=dirmem;<br> *(uint16*)n=ndir;<br> if (tif->tif_flags&TIFF_SWAB)<br> TIFFSwabShort((uint16*)n);<br> n+=2;<br> o=dir;<br> for (m=0; m<ndir; m++)<br> {<br> *(uint16*)n=o->tdir_tag;<br> if (tif->tif_flags&TIFF_SWAB)<br> TIFFSwabShort((uint16*)n);<br> n+=2;<br> *(uint16*)n=o->tdir_type;<br> if (tif->tif_flags&TIFF_SWAB)<br> TIFFSwabShort((uint16*)n);<br> n+=2;<br> *(uint32*)n=(uint32)o->tdir_count;<br> if (tif->tif_flags&TIFF_SWAB)<br> TIFFSwabLong((uint32*)n);<br> n+=4;<br> _TIFFmemcpy(n,&o->tdir_offset,4);<br> n+=4;<br> o++;<br> }<br> *(uint32*)n = (uint32)tif->tif_nextdiroff;<br> }<br></snip><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>