Opened 9 years ago

Closed 9 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 Changed 9 years ago by strk

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 Changed 9 years ago by robe

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 Changed 9 years ago by strk

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 Changed 9 years ago by robe

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 Changed 9 years ago by robe

Keywords: windows added

comment:6 Changed 9 years ago by strk

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

comment:7 Changed 9 years ago by robe

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 Changed 9 years ago by robe

strk,

NULL also crashes the server.

comment:9 Changed 9 years ago by strk

Can you run with a debugging build of postgis ?

comment:10 Changed 9 years ago by strk

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

comment:11 Changed 9 years ago by strk

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

comment:12 Changed 9 years ago by robe

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

comment:13 Changed 9 years ago by pramsey

Crash removed for NULL proj4text in 1.5 at r8909.

comment:14 Changed 9 years ago by pramsey

Resolution: fixed
Status: newclosed

Crasher removed from 2.0 at r8910.

comment:15 Changed 9 years ago by robe

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 Changed 9 years ago by pramsey

See if 1.5 is better at r9670?

comment:17 Changed 9 years ago by robe

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.