Opened 13 years ago

Closed 13 years ago

#1150 closed defect (fixed)

Prevent people from inserting entries in spatial_ref_sys with no proj4text

Reported by: robe Owned by: strk
Priority: medium Milestone: PostGIS 1.5.4
Component: postgis Version: 1.5.X
Keywords: windows Cc:

Description

At least on windows if you have an empty proj4text for example in #1149

Then PostgreSQL comes crashing down if you try to transform to such a beast. We shouldn't even be allowing people to insert these things in the table to begin with.

Change History (17)

comment:1 by strk, 13 years ago

The crash should be fixed at a lower level. I see possible valid reasons not to insert a proj4 string (yet): you don't know it and don't want to think about it _now_ but you will later, looking at the srtext..

comment:2 by robe, 13 years ago

Owner: changed from robe to strk

Good point. I think you or Mark can take care of this one then. Feel free to push it over to Mark.

comment:3 by strk, 13 years ago

Robe: I get no crash, but an exception, when proj4text is empty:

=# select st_transform('srid=4326;POINT(0 0)'::geometry, 2046);ERROR:  AddToPROJ4SRSCache: couldn't parse proj4 string: '': (null)

This is with current (svn r7968) PostGIS Can you reproduce a real crash on windows with it ?

comment:4 by robe, 13 years ago

Yes crashes on my 1.5 and postgis 2.0 trunk. I tested on 2.0 on both 8.4 and 9.1.

which version of proj are you running. I'm running 4.6.1.

pg_Log doesn't even give any detail -- it just crashed too quickly to be logged. I suspect its one of those tragedies that only befalls windows users.

comment:5 by robe, 13 years ago

Keywords: windows added

comment:6 by strk, 13 years ago

4.7.0 here. Is your crashing with empty or NULL proj4text ?

comment:7 by robe, 13 years ago

well I tried that example you had above 2046 and in my table that is an empty string. Haven't tried null yet.

comment:8 by robe, 13 years ago

strk,

NULL also crashes the server.

comment:9 by strk, 13 years ago

Can you run with a debugging build of postgis ?

comment:10 by strk, 13 years ago

or even better, a backtrace... (looking at the code it seems this might be a proj4 rather than postgis bug).

comment:11 by strk, 13 years ago

Also, does this also happen with PostGIS-2.0/trunk ?

comment:12 by robe, 13 years ago

Yes happens with 2.0 trunk. Not near my compiler at moment. Will try next time.

comment:13 by pramsey, 13 years ago

Crash removed for NULL proj4text in 1.5 at r8909.

comment:14 by pramsey, 13 years ago

Resolution: fixed
Status: newclosed

Crasher removed from 2.0 at r8910.

comment:15 by robe, 13 years ago

Resolution: fixed
Status: closedreopened

Still crashes for me:

insert into spatial_ref_sys (srid, proj4text) values (500001,NULL);
insert into spatial_ref_sys (srid, proj4text) values (500002, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs');
select '#1150', st_astext(st_transform('SRID=500002;POINT(0 0)',500001));

comment:16 by pramsey, 13 years ago

See if 1.5 is better at r9670?

comment:17 by robe, 13 years ago

Resolution: fixed
Status: reopenedclosed

Fine now just gives a notice instead of crashing

ERROR: AddToPROJ4SRSCache: couldn't parse proj4 string: :

Note: See TracTickets for help on using tickets.