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

Mateusz Loskot Mateusz.Loskot at cadcorp.com
Thu Apr 9 02:03:47 PDT 2009


strk wrote: 
> 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.

Yes

> 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).

Yes, as long as you are going to apply use of this to the code?

The fix introduced in r3987 works for most of data I've tested,
so I don't see any point to change it myself, unless I find
it insufficient at some point. 

Best regards,
--
Mateusz Loskot
Senior Programmer, Cadcorp
http://www.cadcorp.com





More information about the postgis-devel mailing list