Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#3506 closed defect (fixed)

Spatialite: crashes when creating a layer with a SRS not recognized as EPSG

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.7.2
Component: OGR_SF Version: 1.7.0
Severity: normal Keywords: sqlite spatialite
Cc: simon.okeefe@…

Description

Several problems diagnosed that can lead to segfault when creating a layer with a SRS that is not recognized as EPSG:

  • When creating a spatialite DB, there are missing NOT NULL constraints on the geometry_columns and spatial_ref_sys, contrary to the table schema created by spatialite utilities
  • The code is not robust to NULL values when reading spatial_ref_sys table
  • When no authority name/code is detected when inserting into the spatial_ref_sys, we need to use a fake one to respect the table constraints. We'll use 'OGR' as a fake authority name.
  • No effort is made to identify the SRS as a EPSG code. This is problematic when reading the SRS of shapefiles that have no authority.

Change History (2)

comment:1 by Even Rouault, 14 years ago

Resolution: fixed
Status: newclosed

r19229 /trunk/gdal/ogr/ogrsf_frmts/sqlite/ (ogrsqlitedatasource.cpp ogrsqlitedriver.cpp): Spatialite: improve robustness when finding NULL values in spatial_ref_sys table; auto-identify EPSG SRS when creating a layer; create spatial_ref_sys and geometry_columns table with proper NOT NULL constraints (#3506)

r19230 /branches/1.7/gdal/ogr/ogrsf_frmts/sqlite/ (ogrsqlitedatasource.cpp ogrsqlitedriver.cpp): Spatialite: improve robustness when finding NULL values in spatial_ref_sys table; auto-identify EPSG SRS when creating a layer; create spatial_ref_sys and geometry_columns table with proper NOT NULL constraints (#3506)

r19231 /trunk/autotest/ogr/ogr_sqlite.py: Test fix for #3506

comment:2 by Even Rouault, 14 years ago

r19237 /trunk/gdal/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp: SQLite: import 'clean' EPSG SRS and use GEOGCS citation as content for ref_sys_name field for geographic SRS (complementary fix for #3506)

r19238 /branches/1.7/gdal/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp: SQLite: import 'clean' EPSG SRS and use GEOGCS citation as content for ref_sys_name field for geographic SRS (complementary fix for #3506)

Note: See TracTickets for help on using tickets.