[fdo-trac] #732: WFS: segv on Linux when read feature with many
coordinates
FDO
trac_fdo at osgeo.org
Tue Nov 30 08:04:22 EST 2010
#732: WFS: segv on Linux when read feature with many coordinates
----------------------------------------+-----------------------------------
Reporter: brentrobinson | Owner: brentrobinson
Type: defect | Status: closed
Priority: major | Milestone: 3.6.0
Component: FDO API | Version: 3.5.0
Severity: 2 | Resolution: fixed
Keywords: WFS segv linux coordiantes | External_id:
----------------------------------------+-----------------------------------
Changes (by brentrobinson):
* status: new => closed
* resolution: => fixed
Comment:
Revision: 5837
Author: brentrobinson
Date: 8:02:35 AM, Tuesday, November 30, 2010
Message:
Ticket#739: Fixed a stack overflow which happens when reading features
from XML on Linux. It occurs when a feature has a huge number of
coordinates (about 97,000).
FdoXmlCoordinateGroup parses a wide-char coordinate string. On Linux, it
converts each ordinate to multibyte before converting to double. Space for
the intermediate multbyte was allocated on the program stack (using
alloca). Items allocated by alloca are freed when the current function
returns. However, the ordinates were processed in a loop, meaning that the
stack could overflow if there were enough ordinates.
The fix was to add a function to convert each ordinate. This ensures that
each intermediate multibyte string is free before the next one is
allocated.
Some other fixes were also done to facilitate writing a unit test to cover
this case:
FdoXmlFeatureReaderImpl: changed GetClassDefinition() to return the class
definition for the current feature if it can be determined. This allows
the FdoXmlFeatureSerializer to round trip from an FdoXmlFeatureReader to
an FdoXmlFeatureWriter.
FdoXmlFeaturePropertyReaderImpl: send the current feature's class
definition via the FeatureStart event, if the class definition can be
determined.
FdoXmlSchemaManager: if XML Schema mappings not set on the XML Flags that
were passed in, check if they can be retrieved from the feature schemas.
This provides a bit more convenience. If the app deserializes the feature
schemas and passes them to an FdoXmlFeatureReader, the app no longer has
to transfer the XML schema mappings from the feature schemas to the flags.
----
Modified : /trunk/Fdo/UnitTest/CMakeLists.txt
Modified : /trunk/Fdo/UnitTest/GmlTest.cpp
Modified : /trunk/Fdo/UnitTest/GmlTest.h
Modified : /trunk/Fdo/UnitTest/Makefile.am
Added : /trunk/Fdo/UnitTest/hawaii_in.xml
Added : /trunk/Fdo/UnitTest/hawaii_schema.xml
Modified : /trunk/Fdo/Unmanaged/Src/Fdo/Xml/CoordinateGroup.cpp
Modified : /trunk/Fdo/Unmanaged/Src/Fdo/Xml/FeaturePropertyReaderImpl.cpp
Modified : /trunk/Fdo/Unmanaged/Src/Fdo/Xml/FeatureReaderImpl.cpp
Modified : /trunk/Fdo/Unmanaged/Src/Fdo/Xml/FeatureReaderImpl.h
Modified : /trunk/Fdo/Unmanaged/Src/Fdo/Xml/SchemaManager.cpp
--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/732#comment:1>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list