From 89cb4cfa09c0a748d77ed649064555a9ddfaeb89 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Wed, 7 Mar 2012 05:31:24 +0000 Subject: [PATCH] Crash in ST_Project on NULL input (#1658) git-svn-id: http://svn.osgeo.org/postgis/trunk@9414 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/geography_measurement.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); -- 2.50.1