[geos-devel] Memory problems while parsing WKB
Andreas Volz
lists at brachttal.net
Wed Apr 18 17:33:32 EDT 2007
Am Wed, 18 Apr 2007 22:52:21 +0200 schrieb Mateusz Loskot:
> Andreas Volz wrote:
> > 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.
>
> Andreas,
>
> Thanks for the example.
>
> Could you tell me what version of GEOS do you use?
>
> I suppose it's line of GEOS 2.x because the example
> does not compile with 3.x.
>
> Am I correct?
[I] sci-libs/geos
Available versions: 2.2.1 2.2.3 ~3.0.0_rc3
Installed versions: 2.2.3(13:38:02 24.03.2007)(-doc python ruby)
Homepage: http://geos.refractions.net
Description: Geometry Engine - Open Sour
It's version 2.2.3, because this is stable in Gentoo Linux. There's
also 3.0.0_rc3 available, but not in stable. I like only to update if
there's really no other solution.
Has the API so much changed between 2.x and 3.x?
regards
Andreas
More information about the geos-devel
mailing list