[postgis-devel] [WKT Raster] Random bands truncation

strk strk at keybit.net
Thu Apr 9 00:37:11 PDT 2009


On Wed, Apr 08, 2009 at 05:54:44PM +0100, Mateusz Loskot wrote:
> Folks,
> 
> I have submitted fix for this bug (r3987).
> It seems to work, but it's possible there are more similar
> places around that will leak at some point.
> 
> Generally, it's not safe to assume this:
> 
> assert(0 == (((uint64_t)ptr) % 8) );

I think the proble has been that the code assumed
a just-allocated pointer was on 8-byte boundary.
We can't assume that, it turns out, and we shouldn't
need to care, as well as it is aligned to the "max"
alignemnt for the architecture.

PostgreSQL headers have a MAXALIGN macro for that.
*max* alignment should probably substitute the hard-coded
'8' value for the serialized format (also in the RFC).

--strk;

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple! 



More information about the postgis-devel mailing list