Bug report #8232

QgsVectorDataProvider.uniqueValues() crash if there is a NULL value in selected index field

Added by Daniel Vaz over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System:Linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:up-/downstream
Crashes QGIS or corrupts data:No Copied to github as #:17044

Description

If there are NULL values in field of a shapefile, the python Qgis API method

QgsVectorDataProvider.uniqueValues
raises a segmentation fault.

There is sample dataset attached and a python standalone minimal application that shows the bug.

polygons.zip (1.91 KB) Daniel Vaz, 2013-07-07 08:11 AM

test_qgsvectordataprovider.py Magnifier (488 Bytes) Daniel Vaz, 2013-07-07 08:11 AM

bug8232.cpp Magnifier (807 Bytes) Daniel Vaz, 2013-07-07 03:02 PM

Associated revisions

Revision bf1d1b04
Added by Jürgen Fischer over 7 years ago

ogr provider: avoid GDAL #4509 (fixes #8232)

History

#1 Updated by Daniel Vaz over 7 years ago

This bug was found while attempt to solve the bug #8219.

#2 Updated by Daniel Vaz over 7 years ago

The main cause is underlying c++ code. The following code attached shows the bug in c++

#3 Updated by Jürgen Fischer over 7 years ago

  • Resolution set to up-/downstream

apparently a GDAL/OGR problem:

$ ogrinfo -sql 'SELECT DISTINCT "name" FROM "polygons" ORDER BY name ASC' .
INFO: Open of `.'
      using driver `ESRI Shapefile' successful.

Layer name: polygons
Geometry: Polygon
Segmentation fault (core dumped)

#4 Updated by Jürgen Fischer over 7 years ago

  • Subject changed from Python API QgsVectorDataProvider.uniqueValues() crash if there is a NULL value in selected index field to QgsVectorDataProvider.uniqueValues() crash if there is a NULL value in selected index field

#5 Updated by Jürgen Fischer over 7 years ago

  • Category changed from Python plugins to Vectors

#6 Updated by Jürgen Fischer over 7 years ago

Reproducable with GDAL 1.9, but not 1.10.

#7 Updated by Daniel Vaz over 7 years ago

I think that bug was fixed in GDAL #4509

#8 Updated by Jürgen Fischer over 7 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF