Skip to content

Commit

Permalink
[OGR provider] Do not return wkbUnknown25D, wkbUnknownM/Z/ZM layer ge…
Browse files Browse the repository at this point in the history
…ometry types

Those are illegal QgsWKBTypes::Type / QGis::WkbType values, and can cause
undefined behaviour outside of the provider.

Fixes #15064
  • Loading branch information
rouault committed Jun 18, 2016
1 parent df8dca2 commit b0c519e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -665,6 +665,11 @@ OGRwkbGeometryType QgsOgrProvider::getOgrGeomType( OGRLayerH ogrLayer )
{
geomType = OGR_FD_GetGeomType( fdef );

// Handle wkbUnknown and its Z/M variants. QGIS has no unknown Z/M variants,
// so just use flat wkbUnknown
if ( wkbFlatten( geomType ) == wkbUnknown )
geomType = wkbUnknown;

// Some ogr drivers (e.g. GML) are not able to determine the geometry type of a layer like this.
// In such cases, we use virtual sublayers for each geometry if the layer contains
// multiple geometries (see subLayers) otherwise we guess geometry type from first feature
Expand Down

0 comments on commit b0c519e

Please sign in to comment.