Opened 7 years ago

Closed 7 years ago

#3965 closed defect (fixed)

String comparison problem in ogr_srs_esri.cpp

Reported by: rprinceley Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: OGR_SRS Version: 1.8.0
Severity: normal Keywords:
Cc: gaopeng, esrixz, Xiuguang

Description

In RemapNameBasedOnKeyName?():

  for( i = 0; mappingTable[i] != NULL; i += 2 )
  {
    n = strlen(pszName);
    if( EQUALN(pszName, mappingTable[i],n) )
    {
      iIndex = i;
      break;

We have a "Sphere_of_Radius_XXX" entry in one of our tables, which is incorrectly returned as a match for user defined spheroid named "Sphere". Ideally, this comparison should include entire string.

Change History (3)

comment:1 Changed 7 years ago by warmerdam

Cc: esrixz added
Status: newassigned

Robin,

That code was contributed by Xiaguang Zhou and I am not sure why he chose to check for prefixes. I am hesitant to remove this without knowing the reason, but I think I could safely add a first pass loop that would look for exact matches if that would help.

comment:2 Changed 7 years ago by rprinceley

Cc: Xiuguang added

Frank,

In 1.6-esri source this is an EQUAL check but EQUALN in 1.8. As such, it should be safe to change this in 1.8.

comment:3 Changed 7 years ago by warmerdam

Component: GDAL_RasterOGR_SRS
Milestone: 1.9.0
Resolution: fixed
Status: assignedclosed

OK, good enough for me. I do wish I knew why the partial comparison was put in place.

Updated in trunk (r21828). I see 1.8-esri already has this. I don't think it is critical in 1.8 branch. Let me know if you think otherwise.

Note: See TracTickets for help on using tickets.