[geos-devel] buffer() segfaults

David Blasby dblasby at refractions.net
Fri Aug 1 14:57:21 EDT 2003


This little program segfaults in the buffer() function:

#0  0x4009138e in geos::Label::setLocation (this=0x8054610,
     geomIndex=1076957745, location=1) at ../graph/Label.cpp:94
#1  0x4009082c in geos::GeometryGraph::insertPoint (this=0x8054588,
     argIndex=1076957745, coord=@0x8054a60, onLocation=1)
     at ../graph/GeometryGraph.cpp:285
#2  0x4009052c in geos::GeometryGraph::addEdge (this=0x8054588, e=0x8054478)
     at ../graph/GeometryGraph.cpp:231
#3  0x400b22ed in geos::BufferOp::nodeEdges (this=0x80535f8, 
edges=0x8053be0)
     at ../operation/buffer/BufferOp.cpp:82
#4  0x400b217a in geos::BufferOp::computeBuffer (this=0x80535f8, 
distance=10,
     quadrantSegments=6) at ../operation/buffer/BufferOp.cpp:57
#5  0x400b20c4 in geos::BufferOp::getResultGeometry (this=0x80535f8,
     distance=10) at ../operation/buffer/BufferOp.cpp:45
#6  0x400b1d24 in geos::BufferOp::bufferOp (g=0x804de40, distance=10)
     at ../operation/buffer/BufferOp.cpp:8
#7  0x4006f513 in geos::Geometry::buffer (this=0x804de40, distance=10)
     at Geometry.cpp:283
#8  0x08049e82 in main (argc=1, argv=0xbffff754) at test.cpp:30
#9  0x4018e280 in __libc_start_main () from /lib/libc.so.6


It throws an ABORT if you buffer(1.0).



#include "io.h"
//g++ -g test.cpp -I/usr/local/include/geos -lgeos ; ./a.out

using namespace geos;

int main(int argc, char** argv)
{

	try {

	WKTReader *r = new WKTReader();

	Geometry *g1,*g2, *g3;

	g1 =r->read("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))");
	g2 =r->read("POLYGON((5 5, 15 5, 15 7, 5 7, 5 5))");


	cout << "g1 is valid:" << g1->isValid()<< endl;
	cout << "g2 is valid:" << g2->isValid()<< endl<< endl;


	//g3 = g1->intersection(g2);
	//cout <<"g1->intersection(g2)::" << g3->toText()<< endl;

	g3 = g1->buffer(10.0);


	cout << "g1->buffer(10.0)::" << g3->toText() << endl;

	}
	catch (char *message)
	{
		cout << message << endl;
	}
	catch (...)
	{
		cout << "unknown error occured"<< endl;
	}

	return 0;
}





More information about the geos-devel mailing list