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

Gavin Cramer gavin.cramer at autodesk.com
Thu Aug 21 16:19:28 EDT 2008


This ring closure test has been of value in catching defects during development, by throwing the exception when creating a new polygon.

However, it similarly prevents success in production when trying to read invalid data, before it can be fixed.

Since the outgoing polygons could be checked through a separate test, I think that the test in the geometry factory is more trouble than it is worth, and should be removed.

Gavin


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Dan Stoica
Sent: Thursday, August 21, 2008 4:13 PM
To: FDO Users Mail List
Subject: RE: [fdo-users] How does FDO handle invalid fgf geometries?

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...


Dan.

-----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?

Jackie,

 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 garbage.

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

http://mateusz.loskot.net/tmp/fdo/test_geometry_factory.cpp.html

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) FDO_1_INVALID_INPUT_ON_CLASS_CREATION


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
http://lists.osgeo.org/mailman/listinfo/fdo-users


More information about the fdo-users mailing list