Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#6237 closed defect (fixed)

GPX Regression in gdal 2?

Reported by: BergWerkGis Owned by: warmerdam
Priority: normal Milestone: 2.0.2
Component: OGR_SF Version: unspecified
Severity: major Keywords: gpx time
Cc:

Description

  • Both attached files work with gdal 1.11.
  • "does-not-work.gpx" fails with gdal 2.

Failing GPX has <trk><extensions><time>. Working GPX does not.

Reproduce with: ogrinfo does-not-work.gpx -al

Fails with:

Layer name: tracks
Geometry: Multi Line String
Segmentation fault: 11

Faulting source seems to be:

FAULTING_SOURCE_LINE:  gdal\port\cpl_conv.cpp
FAULTING_SOURCE_LINE_NUMBER:  256

FAULTING_SOURCE_CODE:  
   252: 
   253:     if( pszString == NULL )
   254:         pszString = "";
   255: 
>  256:     pszReturn = (char *) CPLMalloc(strlen(pszString)+1);
   257:     if( pszReturn == NULL )
   258:     {
   259:         CPLError( CE_Fatal, CPLE_OutOfMemory,
   260:                   "CPLStrdup(): Out of memory allocating %ld bytes.\n",
   261:                   (long) strlen(pszString) );

Stack on Windows:

gdal!CPLStrdup(char * pszString = 0x0064060f`0b0a07df "--- memory read error at address 0x0064060f`0b0a07df ---")+0x27 [c:\mb\windows-builds-64\packages\node-gdal\deps\libgdal\gdal\port\cpl_conv.cpp @ 256]
gdal!OGRFeature::SetField(int iField = 0n12, union OGRField * puValue = 0x000000bb`7534e830)+0xf9 [c:\mb\windows-builds-64\packages\node-gdal\deps\libgdal\gdal\ogr\ogrfeature.cpp @ 3628]
gdal!OGRGPXLayer::endElementCbk(char * pszName = 0x000000bb`755a3430 "time")+0x790 [c:\mb\windows-builds-64\packages\node-gdal\deps\libgdal\gdal\ogr\ogrsf_frmts\gpx\ogrgpxlayer.cpp @ 914]
gdal!doContent(struct XML_ParserStruct * parser = 0x000000bb`75591000, int startTagLevel = 0n0, struct encoding * enc = 0x00007ffa`5e64c870, char * s = 0x000000bb`7534ebc0 "</time>..<label xmlns="http://www.topografix.com/GPX/gpx_overlay???", char * end = 0x000000bb`7534ec00 "???", char ** nextPtr = 0x000000bb`7534e9d0, unsigned char haveMore = 0x01 '')+0x6de [c:\mb\windows-builds-64\packages\node-gdal\deps\libexpat\expat\lib\xmlparse.c @ 2533]
gdal!contentProcessor(struct XML_ParserStruct * parser = 0x000000bb`75591000, char * start = <Value unavailable error>, char * end = <Value unavailable error>, char ** endPtr = <Value unavailable error>)+0x36 [c:\mb\windows-builds-64\packages\node-gdal\deps\libexpat\expat\lib\xmlparse.c @ 2105]
gdal!XML_Parse(struct XML_ParserStruct * parser = 0x000000bb`75591000, char * s = 0x000000bb`7534ea00 "<wpt lat="31.09859400" lon="-7.91275300">..<ele>0.000</ele>..<time>2015-06-13T17:18:53Z</time>..<name>Sidi Chamarouch</name>..<sym>Waypoint</sym>..<extensions>..<label xmlns="http://www.topografix.com/GPX/gpx_overlay/0/3">..<label_text>Sidi Chamarouch</label_text>..</label>..</extensions>..</wpt>..<trk>..<name>Dag 1: Tassa Ouirgane - Tiziane </name>..<extensions>..<time xmlns="http://www.topografix.com/GPX/gpx_modified/0/1">2015-10-11T15:06:33Z</time>..<label xmlns="http://www.topografix.com/GPX/gpx_overlay???", int len = 0n512, int isFinal = 0n0)+0x17a [c:\mb\windows-builds-64\packages\node-gdal\deps\libexpat\expat\lib\xmlparse.c @ 1558]
gdal!OGRGPXLayer::GetNextFeature(void)+0x11d [c:\mb\windows-builds-64\packages\node-gdal\deps\libgdal\gdal\ogr\ogrsf_frmts\gpx\ogrgpxlayer.cpp @ 1046]

Stack on OS X:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_c.dylib               0x00007fff946f9d32 strlen + 18
1   gdal.node                       0x000000010495728f CPLStrdup + 29
2   gdal.node                       0x000000010488ab8f OGRFeature::SetField(int, OGRField*) + 373
3   gdal.node                       0x0000000104c980e8 OGRGPXLayer::endElementCbk(char const*) + 1848
4   gdal.node                       0x0000000104995eda doContent + 3668
5   gdal.node                       0x0000000104993ee2 contentProcessor + 53
6   gdal.node                       0x0000000104993595 doProlog + 8116
7   gdal.node                       0x00000001049914c4 prologProcessor + 93
8   gdal.node                       0x0000000104990f23 XML_ParseBuffer + 178
9   gdal.node                       0x0000000104c984a1 OGRGPXLayer::GetNextFeature() + 273
10  gdal.node                       0x00000001048c820b OGRLayer::GetFeatureCount(int) + 45
11  gdal.node                       0x000000010484c173 node_gdal::LayerFeatures::count(Nan::FunctionCallbackInfo<v8::Value> const&) + 313

Attachments (2)

works.gpx (1.5 KB) - added by BergWerkGis 2 years ago.
does-not-work.gpx (1.6 KB) - added by BergWerkGis 2 years ago.

Download all attachments as: .zip

Change History (4)

Changed 2 years ago by BergWerkGis

Attachment: works.gpx added

Changed 2 years ago by BergWerkGis

Attachment: does-not-work.gpx added

comment:1 Changed 2 years ago by Even Rouault

Component: defaultOGR_SF
Keywords: gpx time added
Milestone: 2.0.2
Resolution: fixed
Severity: normalmajor
Status: newclosed

trunk r31751, branches/2.0 r31752 "GPX: fix crash when parsing a 'time' extension element at route/track level (2.0 regression, #6237)"

comment:2 Changed 2 years ago by Even Rouault

Note: The time element was not set in 1.11 or before. Now it is set.

Note: See TracTickets for help on using tickets.