[Gdal-dev] crash on blank lines in .prj / ESRI TM params

Ben Discoe ben at vterrain.org
Mon Feb 14 22:36:24 EST 2005


I noticed this evening that OGR will crash if asked to parse an ESRI-style
.prj file with some extra whitespace.  Attached is an example, which was
output from the software 'Global Mapper' (GM).

I've cc'd GM's author, so he can address the extra LF characters, but it
would also be good to make OGR a little more robust.  The problem appears to
be an if/else in OSR_GDV (ogr_srs_esri.cpp) which doesn't check for an empty
parameter.  The problem is probably in the calling code though
(importFromESRI) which is making the assumption.

Even when the extra LF are removed, there is a second problem: OGR is
expecting the parameters for TM projections in this order:
1. Scale
2. CenterLat (latitude of the origin)
3. CenterLong (central meridian)
4. FalseEasting
5. FalseNorthing

But GM is writing them in a slightly different order:
1. Scale
2. CenterLong (central meridian)
3. CenterLat (latitude of the origin)
4. FalseEasting
5. FalseNorthing

It seems reasonable to conclude that one of these (OGR or GM) is
wrong/non-standard.

-Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gauss_boaga_west.prj
Type: application/octet-stream
Size: 337 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20050214/55cfb55b/gauss_boaga_west.obj


More information about the Gdal-dev mailing list