Ticket #1528 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Random crashes when using OGR SQL in -where clause

Reported by: mloskot Assigned to: warmerdam
Priority: normal Milestone: 1.4.1
Component: OGR_SF Version: 1.4.0
Severity: major Keywords:
Cc: tamas

Description (Last modified by warmerdam)

The -where clause behaves instable in some cases. When used against MySQL or PostgreSQL, with OGR dialect of SQL, segmantation fault is thrown. It should be handled cleanly, if unsupported dialect is used.

Example of crash:

madmappers:/home/work# /opt/gdal-r11007_x86-linux/bin/ogr2ogr -f MySQL MYSQL:sptest,user=sptest,password=,host=127.0.0.1 -nln locust -update -overwrite FAO_DBsummary.shp -where 'OGR_GEOMETRY=POINT'
Segmentation fault

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1090607360 (LWP 28956)]
0x40357753 in OGRFeature::GetFieldAsString () from /opt/gdal-r11007_x86-linux/lib/libgdal.so.1

The major goal of this report is to review and fix potential problems with handling SQL queries in OGR by various ORG drivers.

Change History

03/25/07 20:29:20 changed by warmerdam

  • priority changed from highest to normal.
  • status changed from new to assigned.
  • description changed.
  • owner changed from mloskot to warmerdam.
  • milestone set to 1.5.0.

03/25/07 20:31:25 changed by warmerdam

  • milestone changed from 1.5.0 to 1.4.1.

03/26/07 23:55:23 changed by warmerdam

  • status changed from assigned to closed.
  • description changed.
  • cc set to tamas.
  • version changed from unspecified to 1.4.0.
  • resolution set to fixed.
  • severity changed from critical to major.

I have confirmed a bug in GetFieldAsString?() on the OGR_GEOMETRY special field if the geometry is actually NULL. Also, some serious error conditions on several other special fields. These have been fixed.

The command indicates an input format of shapefile, so OGR SQL is implicated. After my fixes I see no problem. Unfortunately the original reporter (Nowak) did not bother to attach sample data to demonstrate the bug, so it is hard to know if we have fixed the bug he encountered.

I will port the changes back into 1.4 branch as well.

r11086 and r11087