[SCM] PostGIS branch stable-3.1 updated. 3.1.11-34-gcbc1c7932

git at osgeo.org git at osgeo.org
Thu Jun 5 19:54:06 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, stable-3.1 has been updated
       via  cbc1c79321f6978b6c4ebe233251d3bbf9886383 (commit)
      from  bd53944be2536cb1344ed9eb86442e15c4e7760c (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 cbc1c79321f6978b6c4ebe233251d3bbf9886383
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Jun 5 19:53:57 2025 -0700

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

diff --git a/NEWS b/NEWS
index af7de36ba..0af227571 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ YYYY/MM/DD
  - PCRE2 support for more modern systems (Paul Ramsey)
  - #5921, Crash freeing uninitialized pointer (Arsenii Mukhin)
  - #5912, Crash on GML with xlink and no prefix (Paul Ramsey)
+ - #5905, Crash on deeply nested geometries (Paul Ramsey)
 
 
 PostGIS 3.1.12
diff --git a/postgis/lwgeom_dump.c b/postgis/lwgeom_dump.c
index e096bf3a7..694f6d058 100644
--- a/postgis/lwgeom_dump.c
+++ b/postgis/lwgeom_dump.c
@@ -182,6 +182,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 9955f8a06..4975564db 100644
--- a/postgis/lwgeom_dumppoints.c
+++ b/postgis/lwgeom_dumppoints.c
@@ -271,6 +271,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);

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

Summary of changes:
 NEWS                        | 1 +
 postgis/lwgeom_dump.c       | 3 +++
 postgis/lwgeom_dumppoints.c | 4 ++++
 3 files changed, 8 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list