Ticket #1150 (closed defect: fixed)

Opened 22 months ago

Last modified 13 months ago

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

Changed 22 months 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..

Changed 22 months 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.

Changed 19 months 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 ?

Changed 19 months 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.

Changed 19 months ago by robe

  • keywords windows added

Changed 19 months ago by strk

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

Changed 19 months 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.

Changed 19 months ago by robe

strk,

NULL also crashes the server.

Changed 19 months ago by strk

Can you run with a debugging build of postgis ?

Changed 19 months ago by strk

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

Changed 19 months ago by strk

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

Changed 19 months ago by robe

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

Changed 16 months ago by pramsey

Crash removed for NULL proj4text in 1.5 at r8909.

Changed 16 months ago by pramsey

  • status changed from new to closed
  • resolution set to fixed

Crasher removed from 2.0 at r8910.

Changed 15 months ago by robe

  • status changed from closed to reopened
  • resolution fixed deleted

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));

Changed 13 months ago by pramsey

See if 1.5 is better at r9670?

Changed 13 months ago by robe

  • status changed from reopened to closed
  • resolution set to fixed

Fine now just gives a notice instead of crashing

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

Note: See TracTickets for help on using tickets.