From: Paul Ramsey Date: Wed, 7 Mar 2012 05:31:24 +0000 (+0000) Subject: Crash in ST_Project on NULL input (#1658) X-Git-Tag: 2.0.0beta2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89cb4cfa09c0a748d77ed649064555a9ddfaeb89;p=postgis Crash in ST_Project on NULL input (#1658) git-svn-id: http://svn.osgeo.org/postgis/trunk@9414 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_measurement.c b/postgis/geography_measurement.c index 063e350ac..a8b859cf2 100644 --- a/postgis/geography_measurement.c +++ b/postgis/geography_measurement.c @@ -611,6 +611,10 @@ Datum geography_project(PG_FUNCTION_ARGS) SPHEROID s; uint32_t type; + /* Return NULL on NULL distance or geography */ + if ( PG_ARGISNULL(0) || PG_ARGISNULL(1) ) + PG_RETURN_NULL(); + /* Get our geometry object loaded into memory. */ g = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); @@ -622,10 +626,6 @@ Datum geography_project(PG_FUNCTION_ARGS) PG_RETURN_NULL(); } - /* Return NULL on NULL distance */ - if ( PG_ARGISNULL(1) ) - PG_RETURN_NULL(); - distance = PG_GETARG_FLOAT8(1); /* Distance in Meters */ lwgeom = lwgeom_from_gserialized(g);