[geos-devel] bugfix in collection's copy constructor

strk strk at keybit.net
Thu Dec 11 11:04:08 EST 2003


GeometryCollection copy constructor used to swallow copy
the vector of referenced geometries. Fixed to call clone()
on each of the sub-objects [ there should be a more elegant
C++ construct for this but the clone() call works fine ].

Nonetheless the geos2postgis bug is still there.
Here is a reduced exploit:

-- This works (4 geometries in collection)
select buffer('GEOMETRYCOLLECTION(LINESTRING(0 0,1 1),LINESTRING(0 0,1 1),LINESTRING(0 0,1 1),LINESTRING(0 0,1 1))', 0);

-- This faults (the 5th geometry in collection)
select buffer('GEOMETRYCOLLECTION(LINESTRING(0 0,1 1),LINESTRING(0 0,1 1),LINESTRING(0 0,1 1),LINESTRING(0 0,1 1),LINESTRING(0 0,1 1))', 0);

Note that these test only works if the buffer function returns a cloned
input geometry when called with 0 as distance (needs CVS sync - finally
committed).

--strk;



More information about the geos-devel mailing list