[geos-devel] Memory problems while parsing WKB

Mateusz Loskot mateusz at loskot.net
Wed Apr 18 14:52:51 EDT 2007

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?


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

Your code is not usable, because it's specific to your particular
environment and data.

Mateusz Loskot

More information about the geos-devel mailing list