[postgis-devel] segfault fix and spatial_ref_sys
strk at refractions.net
strk at refractions.net
Wed Aug 10 16:42:13 PDT 2005
I've just fixed a bug in the transform_geom function
segfaulting on proj4 error.
proj4 errors should not occur in everyday usage,
anyway it seems we have a problem with spatial_ref_sys
records triggering them.
The problem seems related to the lack of +proj parameter.
The following query would segfault or (if you either applied
the attached patch or are lucky) report an error:
SELECT transform('SRID=4326;POINT(0 0)', srid)
FROM spatial_ref_sys WHERE proj4text !~ 'proj';
This is the error (for srid=2046..2055):
couldn't parse proj4 output string:
'+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ':
projection not named
This is a list of the 29 corrupted entries, for reference:
srid | proj4text
-------+--------------------------------------------------------
2046 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2047 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2048 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2049 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2050 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2051 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2052 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2053 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2054 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
2055 | +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
22275 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22277 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22279 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22281 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22283 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22285 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22287 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22289 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22291 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22293 | +a=6378249.145 +b=6356514.966398753 +units=m +no_defs
22300 | +a=6378249.2 +b=6356515 +pm=paris +units=km +no_defs
29371 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
29373 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
29375 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
29377 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
29379 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
29381 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
29383 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
29385 | +ellps=bess_nam +to_meter=1.0000135965 +no_defs
--strk;
-------------- next part --------------
Index: lwgeom/lwgeom_transform.c
===================================================================
RCS file: /home/cvs/postgis/postgis/lwgeom/lwgeom_transform.c,v
retrieving revision 1.19
retrieving revision 1.21
diff -U2 -r1.19 -r1.21
--- lwgeom/lwgeom_transform.c 5 Apr 2005 10:18:04 -0000 1.19
+++ lwgeom/lwgeom_transform.c 10 Aug 2005 23:16:26 -0000 1.21
@@ -295,5 +295,5 @@
if ( (input_pj == NULL) || pj_errno)
{
- //pfree(input_proj4);
+ //pfree(input_proj4); // we need this for error reporting
pfree(output_proj4);
pfree(geom);
@@ -306,6 +306,5 @@
if ((output_pj == NULL)|| pj_errno)
{
- pfree(input_proj4);
- //pfree(output_proj4);
+ //pfree(output_proj4); // we need this for error reporting
pj_free(input_pj);
pfree(geom);
More information about the postgis-devel
mailing list