[gdal-dev] GDAL error from Mapserver 7.0

Even Rouault even.rouault at spatialys.com
Fri Sep 11 01:05:29 PDT 2015


Le vendredi 11 septembre 2015 09:40:03, Jukka Rahkonen a écrit :
> Even Rouault <even.rouault <at> spatialys.com> writes:
> > The crash is indeed linked to the fact that a wrong table name was
> > passed.
> 
> And
> 
> > to reach that point the table name was of the form
> > "table_name(geom_column_name)", right ?
> > 
> > Fixed by https://trac.osgeo.org/gdal/ticket/6103
> > 
> > As far as the why there's this one character offset, the fundamental
> > cause
> 
> for
> 
> > the issue, I don't know without having a way to reproduce.
> 
> Hi,
> 
> I got a hint that it might originate from the SQLite driver as well but we
> have not yet understood the code well enough:

Oh.... indeed. I see now what is wrong. You have been correctly hinted.
Fixed by https://trac.osgeo.org/gdal/ticket/6107
The issue was also present in 1.11
The code wasn't careful enough and confused successive identical regular 
characters with consecutive quote characters...

> 
> 
> 
>     size_t nFromPos = osSQLBase.ifind(" from ");
>     if (nFromPos == std::string::npos)
>     {
>         return std::pair<OGRLayer*,
> IOGRSQLiteGetSpatialWhere*>((OGRLayer*)NULL,
> (IOGRSQLiteGetSpatialWhere*)NULL); }
> 
>     char chQuote = osSQLBase[nFromPos + 6];
>     int bInQuotes = (chQuote == '\'' || chQuote == '"' );
>     CPLString osBaseLayerName;
>     for( i = nFromPos + 6 + (bInQuotes ? 1 : 0);
>          i < osSQLBase.size(); i++ )
>     {
>         if (osSQLBase[i] == chQuote && i + 1 < osSQLBase.size() &&
>             osSQLBase[i + 1] == chQuote )
>         {
>             osBaseLayerName += osSQLBase[i];
>             i++;
>         }
>         else if (osSQLBase[i] == chQuote && bInQuotes)
>         {
>             i++;
>             break;
>         }
>         else if (osSQLBase[i] == ' ' && !bInQuotes)
>             break;
>         else
>             osBaseLayerName += osSQLBase[i];
>     }
> 
> -Jukka-
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list