[postgis-devel] non-google bug report,
postgres seg fault when comparing geometries
Cliff Wright
cliff at snipe444.org
Fri Mar 28 11:16:33 PDT 2008
The bug tracker kept asking me to get a google account to report a bug,
which I do not want, so am using this process instead.
When using mapnik to display a NOAA nautical chart a postgres server seg faulted while comparing geometries from 2 different tables.
I did not isolate the exact comparison, however the core dump did indicate
which line and file caused the problem. looking at the code I see a memory
free was called apparently pointing at the wrong object. The same free
is used a couple of lines later pointing at the correct object. The patch
attached shows the fix I used. I was using version 1.3.1, however see the same
bug in subversion.
--
Cliff Wright <cliff at snipe444.org>
-------------- next part --------------
--- lwgeom/lwgeom_functions_basic.c.orig 2007-05-31 06:18:04.000000000 -0700
+++ lwgeom/lwgeom_functions_basic.c 2008-03-27 14:07:58.000000000 -0700
@@ -2726,14 +2726,14 @@
if ( TYPE_GETTYPE(g1->type) != TYPE_GETTYPE(g2->type) )
{
PG_FREE_IF_COPY(g1, 0);
- PG_FREE_IF_COPY(g2, 0);
+ PG_FREE_IF_COPY(g2, 1);
PG_RETURN_BOOL(FALSE); /* different types */
}
if ( TYPE_GETZM(g1->type) != TYPE_GETZM(g2->type) )
{
PG_FREE_IF_COPY(g1, 0);
- PG_FREE_IF_COPY(g2, 0);
+ PG_FREE_IF_COPY(g2, 1);
PG_RETURN_BOOL(FALSE); /* different dimensions */
}