Skip to content

Commit 7b7c377

Browse files
committed
[OGR provider] Do not return wkbUnknown25D, wkbUnknownM/Z/ZM layer geometry types
Those are illegal QgsWKBTypes::Type / QGis::WkbType values, and can cause undefined behaviour outside of the provider. Fixes #15064
1 parent aceef9e commit 7b7c377

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/providers/ogr/qgsogrprovider.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,11 @@ OGRwkbGeometryType QgsOgrProvider::getOgrGeomType( OGRLayerH ogrLayer )
699699
{
700700
geomType = OGR_FD_GetGeomType( fdef );
701701

702+
// Handle wkbUnknown and its Z/M variants. QGIS has no unknown Z/M variants,
703+
// so just use flat wkbUnknown
704+
if ( wkbFlatten( geomType ) == wkbUnknown )
705+
geomType = wkbUnknown;
706+
702707
// Some ogr drivers (e.g. GML) are not able to determine the geometry type of a layer like this.
703708
// In such cases, we use virtual sublayers for each geometry if the layer contains
704709
// multiple geometries (see subLayers) otherwise we guess geometry type from first feature

0 commit comments

Comments
 (0)