Opened 13 years ago

Closed 13 years ago

#732 closed defect (fixed)

WFS: segv on Linux when read feature with many coordinates

Reported by: brentrobinson Owned by: brentrobinson
Priority: major Milestone: 3.6.0
Component: FDO API Version: 3.5.0
Severity: 2 Keywords: WFS segv linux coordiantes
Cc: External ID:

Description

This one only happens on Linux:

  • Using the WFS provider, connect with following connect string:
FeatureServer=http://giswebservices.massgis.state.ma.us/geoserver/wfs
  • Execute an FdoISelect on the MORIS-dot-BOATING_USAGE_POLY class.
  • read through the resulting Feature Reader

A segv will occur while reading features.

Change History (1)

comment:1 by brentrobinson, 13 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.