[postgis-users] crashing PostgreSQL connections

Markus Schaber schabi at logix-tt.com
Wed May 4 02:39:10 PDT 2005


Hi, James,

James Marca wrote:

> james at emma:~$ psql -U slash -d crash -c "SELECT 'SRID=32611;POINT(414160.003328498 3726591.60052614))'::geometry;"
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> connection to server was lost

I cannot reproduce this behaviour with current 1.0.1CVS branch, I get
"ERROR:  parse error - invalid geometry"

Could you give us the output of SELECT postgis_full_version()? Also:
Which platform do you use? (unix command "uname -a" may help).

> and LINESTRING with one point, not two
> 
> james at emma:~$ psql -U slash -d crash -c "SELECT 'SRID=32611;LINESTRING(414160.003328498 3726591.60052614)'::geometry;"
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> connection to server was lost

I get "ERROR:  geometry requires more points" here.

> The moral for me was to find and fix all places in my Java where I
> cast to ::geometry and instead use GeomFromEWKT().

GeomFromEWKT() has the advantage that it is more likely to survive
update transitions such as from hwgeom to lwgeom where the canonical
format changes (that is used by ::geometry casts).

> I have no idea how casting works in postgresql/postGIS.  Is it
> supposed to be this fragile, or can it be made to be an alias for
> GeomFromText or GeomFromEWKT instead?

No, it should not be this fragile (thanks for the bug report), no
database user should be able to crash the server, as this DOSes all
other users by aborting their current transactions. And it is a
potential door for buffer overflows or other exploits.

Internally, they both use the same parser code, but they need different
frontends as the PostgreSQL C representation is different.

Markus



More information about the postgis-users mailing list