Spatialite: crashes when creating a layer with a SRS not recognized as EPSG
|Reported by:||Even Rouault||Owned by:||Even Rouault|
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.