[geos-devel] Memory problems while parsing WKB

Andreas Volz lists at brachttal.net
Wed Apr 18 16:33:05 EDT 2007


Am Wed, 18 Apr 2007 20:52:51 +0200 schrieb Mateusz Loskot:

> Andreas Volz wrote:
> > Hello,
> > 
> > I've problems to parse WKB with GEOS. Here is my sample application:
> > [...]
> > It works in most cases, but sometimes the result values are broken
> > or I get a segfault. So I used valgrind to get some more
> > information. I got this as result:
> > 
> > ==17755== Invalid read of size 4
> > ==17755==    at 0x41327FE: geos::PrecisionModel::makePrecise(double)
> > const (in /usr/lib/libgeos.so.2.2.3) ==17755==    by 0x401D5D5A: ???
> > ==17755==  Address 0x460A544 is 4 bytes inside a block of size 16
> > free'd ==17755==    at 0x40212FA: operator delete(void*)
> > (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so) ==17755==
> > by 0x4132695: geos::PrecisionModel::~PrecisionModel()
> > (in /usr/lib/libgeos.so.2.2.3) ==17755==    by 0x42F083B: (below
> > main) (in /lib/libc-2.5.so) ==17755==
> > 
> > ... and this as often as I read coordinates.
> > 
> > Any ideas why PrecisionModel has this problem? A problem in GEOS
> > WKBParser or my application?
> 
> Andreas,
> 
> Could you provide us with simple but generic program presenting the
> problem? Ideally, if the example:
> - refers only to GEOS, but not to any database
> - shows values of coordinates causing the crash, just hardcoded in the
> program
> 
> Your code is not usable, because it's specific to your particular
> environment and data.

I've created an example without database access:

http://tux-style.de/osm/tmp/proj_test.zip

Makefile
proj_test.cpp
data.bin         - Binary dump of a database line into a file
valgrind.txt     - You see the problem only with valgrind (saved output)

Tell me what else you need if I've not provided enough information.

regards
Andreas



More information about the geos-devel mailing list