[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0-583-gae53a5324

git at osgeo.org git at osgeo.org
Fri Feb 18 21:21:10 PST 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  ae53a53246ccb26a6e82fede1a4184b41bcf097d (commit)
      from  9e14b1d6556caaad41f9326f75a887c427137403 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ae53a53246ccb26a6e82fede1a4184b41bcf097d
Author: Regina Obe <lr at pcorp.us>
Date:   Sat Feb 19 00:21:01 2022 -0500

    Fix PG 15 building atoi removed.  References #5100 for PostGIS 3.3.0

diff --git a/NEWS b/NEWS
index 6923a8e19..588e28e85 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ PostGIS 3.3.0dev
   - GH657, GiST: do not call no-op decompress function (Aliaksandr Kalenik)
   - #4912, GiST: fix crash on STORAGE EXTERNAL for geography (Aliaksandr Kalenik)
   - ST_ConcaveHull GEOS 3.11+ native implementation (Paul Ramsey, Martin Davis)
+  - #5100, Support for PostgreSQL 15 (atoi removal) (Laurenz Albe)
 
  * New features*
   - ST_Letters creates geometries that look like letters (Paul Ramsey)
diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c
index 7dae289bc..4e62e0b10 100644
--- a/postgis/geography_inout.c
+++ b/postgis/geography_inout.c
@@ -34,7 +34,7 @@
 
 #include "utils/elog.h"
 #include "utils/array.h"
-#include "utils/builtins.h"  /* for pg_atoi */
+#include "utils/builtins.h"  /* for text_to_cstring */
 #include "lib/stringinfo.h"  /* For binary input */
 #include "catalog/pg_type.h" /* for CSTRINGOID, INT4OID */
 
diff --git a/postgis/gserialized_typmod.c b/postgis/gserialized_typmod.c
index 9d8119084..aae44bef5 100644
--- a/postgis/gserialized_typmod.c
+++ b/postgis/gserialized_typmod.c
@@ -31,10 +31,11 @@
 #include <float.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include "utils/elog.h"
 #include "utils/array.h"
-#include "utils/builtins.h"  /* for pg_atoi */
+#include "utils/builtins.h"  /* for cstring_to_text */
 #include "lib/stringinfo.h"  /* For binary input */
 #include "catalog/pg_type.h" /* for CSTRINGOID */
 
@@ -272,8 +273,33 @@ static uint32 gserialized_typmod_in(ArrayType *arr, int is_geography)
 		}
 		if ( i == 1 ) /* SRID */
 		{
-			int32_t srid = pg_atoi(DatumGetCString(elem_values[i]), sizeof(int32), '\0');
-			srid = clamp_srid(srid);
+			char *int_string = DatumGetCString(elem_values[i]);
+			char *endp;
+			long l;
+			int32_t srid;
+
+			errno = 0;
+			l = strtol(int_string, &endp, 10);
+
+			if (int_string == endp)
+				ereport(ERROR,
+						(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
+						 errmsg("invalid input syntax for type %s: \"%s\"",
+								"integer", int_string)));
+
+			if (errno == ERANGE || l < INT_MIN || l > INT_MAX)
+				ereport(ERROR,
+						(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
+						 errmsg("value \"%s\" is out of range for type %s", int_string,
+								"integer")));
+
+			if (*endp != '\0')
+				ereport(ERROR,
+						(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
+						 errmsg("invalid input syntax for type %s: \"%s\"",
+								"integer", int_string)));
+
+			srid = clamp_srid(l);
 			POSTGIS_DEBUGF(3, "srid: %d", srid);
 			if ( srid != SRID_UNKNOWN )
 			{
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 34fb10c3d..5cac0ef77 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -2986,8 +2986,8 @@ Datum clusterintersecting_garray(PG_FUNCTION_ARGS)
 	char elmalign;
 
 	/* Null array, null geometry (should be empty?) */
-    if (PG_ARGISNULL(0))
-        PG_RETURN_NULL();
+	if (PG_ARGISNULL(0))
+		PG_RETURN_NULL();
 
 	array = PG_GETARG_ARRAYTYPE_P(0);
     nelems = array_nelems_not_null(array);

-----------------------------------------------------------------------

Summary of changes:
 NEWS                         |  1 +
 postgis/geography_inout.c    |  2 +-
 postgis/gserialized_typmod.c | 32 +++++++++++++++++++++++++++++---
 postgis/lwgeom_geos.c        |  4 ++--
 4 files changed, 33 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list