[SCM] PostGIS branch master updated. 3.5.0-375-g9a9ffca3a

git at osgeo.org git at osgeo.org
Thu Jun 5 18:23:18 PDT 2025


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  9a9ffca3ad604f1728a91cb7e9a31c1069ba7718 (commit)
      from  b0f3bd31eaae7fd29b77bd1b918d421eb6b2f8f5 (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 9a9ffca3ad604f1728a91cb7e9a31c1069ba7718
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Jun 5 18:23:07 2025 -0700

    Guard against overly nested collections in dump functions, references #5905

diff --git a/postgis/lwgeom_dump.c b/postgis/lwgeom_dump.c
index 7933851e5..6ce3bcb14 100644
--- a/postgis/lwgeom_dump.c
+++ b/postgis/lwgeom_dump.c
@@ -180,6 +180,9 @@ Datum LWGEOM_dump(PG_FUNCTION_ARGS)
 			 * stack
 			 */
 
+			if (state->stacklen > MAXDEPTH)
+				elog(ERROR, "Unable to dump overly nested collection.");
+
 			oldcontext = MemoryContextSwitchTo(newcontext);
 
 			node = lwalloc(sizeof(GEOMDUMPNODE));
diff --git a/postgis/lwgeom_dumppoints.c b/postgis/lwgeom_dumppoints.c
index 4fc0e3f9d..aef606116 100644
--- a/postgis/lwgeom_dumppoints.c
+++ b/postgis/lwgeom_dumppoints.c
@@ -272,6 +272,10 @@ Datum LWGEOM_dumppoints(PG_FUNCTION_ARGS) {
 
 		/* if a collection and we have more geoms */
 		if (node->idx < lwcoll->ngeoms) {
+
+			if(state->stacklen >= MAXDEPTH)
+				elog(ERROR, "Unabled to dump overly nested collection");
+
 			/* push the next geom on the path and the stack */
 			lwgeom = lwcoll->geoms[node->idx++];
 			state->path[state->pathlen++] = Int32GetDatum(node->idx);
@@ -494,6 +498,9 @@ Datum LWGEOM_dumpsegments(PG_FUNCTION_ARGS)
 			/* if a collection and we have more geoms */
 			if (node->idx < lwcoll->ngeoms)
 			{
+				if (state->stacklen > MAXDEPTH)
+					elog(ERROR, "Unable to dump overly nested collection");
+
 				/* push the next geom on the path and the stack */
 				lwgeom = lwcoll->geoms[node->idx++];
 				state->path[state->pathlen++] = Int32GetDatum(node->idx);

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

Summary of changes:
 postgis/lwgeom_dump.c       | 3 +++
 postgis/lwgeom_dumppoints.c | 7 +++++++
 2 files changed, 10 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list