[SCM] PostGIS branch master updated. 3.6.0rc2-665-g322177e53

git at osgeo.org git at osgeo.org
Wed Jun 24 11:05:01 PDT 2026


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  322177e5376d9e38e0694b72403770755c80adb6 (commit)
       via  b7b0441412680f043caa0f8ef776232c63bc5df0 (commit)
      from  98bf6ad503163840afa6422b99dad6f4c5b658ce (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 322177e5376d9e38e0694b72403770755c80adb6
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Jun 24 17:49:27 2026 +0000

    Restrict number of added edges to 100 in catmull smoothing

diff --git a/liblwgeom/cunit/cu_catmullrom.c b/liblwgeom/cunit/cu_catmullrom.c
index 1d9ff4e0c..775394fb3 100644
--- a/liblwgeom/cunit/cu_catmullrom.c
+++ b/liblwgeom/cunit/cu_catmullrom.c
@@ -3,7 +3,7 @@
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
  *
- * Copyright 2026 PostGIS contributors
+ * Copyright 2026 Darafei Praliaskouski <me at komzpa.net>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -188,6 +188,22 @@ do_test_catmull_rom_points(void)
 	do_test_catmull_rom("MULTIPOINT((1 2),(3 4))", "MULTIPOINT(1 2,3 4)", 5);
 }
 
+static void
+do_test_catmull_rom_nsegments_cap(void)
+{
+	LWGEOM *geom_in, *geom_out;
+
+	cu_error_msg_reset();
+	geom_in = lwgeom_from_wkt("LINESTRING(0 0,1 0,2 0,3 0)", LW_PARSER_CHECK_NONE);
+	geom_out = lwgeom_catmull_rom(geom_in, 101);
+
+	ASSERT_STRING_EQUAL(cu_error_msg, "lwgeom_catmull_rom: nSegments must be <= 100");
+
+	lwgeom_free(geom_in);
+	if (geom_out)
+		lwgeom_free(geom_out);
+	cu_error_msg_reset();
+}
 
 void catmullrom_suite_setup(void);
 void catmullrom_suite_setup(void)
@@ -198,4 +214,5 @@ void catmullrom_suite_setup(void)
 	PG_ADD_TEST(suite, do_test_catmull_rom_polygons);
 	PG_ADD_TEST(suite, do_test_catmull_rom_zm);
 	PG_ADD_TEST(suite, do_test_catmull_rom_points);
+	PG_ADD_TEST(suite, do_test_catmull_rom_nsegments_cap);
 }
diff --git a/liblwgeom/lwsmoothing.c b/liblwgeom/lwsmoothing.c
index 8d7e256f5..4b98ae9dc 100644
--- a/liblwgeom/lwsmoothing.c
+++ b/liblwgeom/lwsmoothing.c
@@ -412,6 +412,11 @@ lwcollection_catmull_rom(const LWCOLLECTION *igeom, int n_segments)
 LWGEOM *
 lwgeom_catmull_rom(const LWGEOM *igeom, int n_segments)
 {
+	if (n_segments > 100)
+	{
+		lwerror("lwgeom_catmull_rom: nSegments must be <= 100");
+		return NULL;
+	}
 	switch (igeom->type)
 	{
 	case POINTTYPE:
diff --git a/postgis/lwgeom_functions_analytic.c b/postgis/lwgeom_functions_analytic.c
index 6d6ca9e55..c424ba177 100644
--- a/postgis/lwgeom_functions_analytic.c
+++ b/postgis/lwgeom_functions_analytic.c
@@ -178,8 +178,8 @@ Datum LWGEOM_CatmullRomSmoothing(PG_FUNCTION_ARGS)
 	if ((PG_NARGS() > 1) && (!PG_ARGISNULL(1)))
 		n_segments = PG_GETARG_INT32(1);
 
-	if (n_segments < 2)
-		elog(ERROR, "nSegments must be >= 2: %s", __func__);
+	if (n_segments < 2 || n_segments > 100)
+		elog(ERROR, "nSegments must be between 2 and 100: %s", __func__);
 
 	in = lwgeom_from_gserialized(geom);
 	out = lwgeom_catmull_rom(in, n_segments);
diff --git a/regress/core/catmullrom.sql b/regress/core/catmullrom.sql
index fe4d9d533..e88cff3f2 100644
--- a/regress/core/catmullrom.sql
+++ b/regress/core/catmullrom.sql
@@ -37,3 +37,6 @@ SELECT '10', postgis_getbbox(g) AS box FROM geom;
 
 -- Triangle polygon ring has npoints-1=3 unique pts (<4), return original
 SELECT '11', ST_AsText(ST_CatmullRomSmoothing('POLYGON((0 0, 4 0, 2 4, 0 0))', 5));
+
+-- Maximum nSegments of 100 is accepted
+SELECT '12', ST_NPoints(ST_CatmullRomSmoothing('LINESTRING(0 0, 1 0, 2 0, 3 0)', 100));
diff --git a/regress/core/catmullrom_expected b/regress/core/catmullrom_expected
index ef9dcc837..c972e5153 100644
--- a/regress/core/catmullrom_expected
+++ b/regress/core/catmullrom_expected
@@ -9,3 +9,4 @@
 9|LINESTRING Z (0 0 0,0.5 0 5,1 0 10,1.5 0 15,2 0 20,2.5 0 25,3 0 30)
 10|BOX(0 0,3 0)
 11|POLYGON((0 0,4 0,2 4,0 0))
+12|301

commit b7b0441412680f043caa0f8ef776232c63bc5df0
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Jun 24 17:48:56 2026 +0000

    Ignore postgis/cunit/cu_tester

diff --git a/.gitignore b/.gitignore
index 57649dd75..b7343eb5a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -129,6 +129,7 @@ macros/ltversion.m4
 *.o
 postgis_config.h
 postgis/Makefile
+postgis/cunit/cu_tester
 postgis/geobuf.pb-c.c
 postgis/geobuf.pb-c.h
 postgis/legacy_gist.sql

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

Summary of changes:
 .gitignore                          |  1 +
 liblwgeom/cunit/cu_catmullrom.c     | 19 ++++++++++++++++++-
 liblwgeom/lwsmoothing.c             |  5 +++++
 postgis/lwgeom_functions_analytic.c |  4 ++--
 regress/core/catmullrom.sql         |  3 +++
 regress/core/catmullrom_expected    |  1 +
 6 files changed, 30 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list