[fdo-users] How does FDO handle invalid fgf geometries?

Dan Stoica dan.stoica at autodesk.com
Thu Aug 21 16:12:50 EDT 2008

Did some investigations on this matter. Turns out that:

a) the polygon in question has a ring which is not closed.
b) the geometry factory throws an appropriate exception "Open ring"
c) the exception is not caught by GetText()
d) for some odd reason the exception is turned into "memory allocation error"

Therefore, the quick solution for Jackie is to catch the exception.

Going forward, we might want to get rid of the 'is polygon closed?' test...


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Mateusz Loskot
Sent: Thursday, August 21, 2008 10:51 AM
To: FDO Users Mail List
Subject: Re: [fdo-users] How does FDO handle invalid fgf geometries?

Jackie Ng wrote:
> Hi All,
> How does FDO handle invalid FGF binary data?


 From my experience, I've observed that FDO does not strictly
validate FGF/WKB input on geometry creation.
Actually, GeometryFactory checks if WKB stream has minimal length of 9
bytes and it does not prevent to create geometry from bytes stream of

Here is a small test of valid and invalid WKB input (see main function):


This is the result of 3 test cases included in the test:

Expected WKT: POINT(15.123 21.456)
Output WKT  : POINT (-7.84591113289983e+298 0)

Expected WKT: POINT(15.123 21.456)
Output WKT  : POINT (15.123 21.456)

*** FDO Error:
   *** (.\Src\Geometry\Fgf\GeometryFactory.cpp: 568)

Best regards,
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
fdo-users mailing list
fdo-users at lists.osgeo.org

More information about the fdo-users mailing list