[SCM] PostGIS branch stable-3.2 updated. 3.2.7-47-g16a2ac1ad

git at osgeo.org git at osgeo.org
Tue Jul 22 03:05:16 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.2 has been updated
       via  16a2ac1ad850b3d953878741aa1bc3ae790c59e9 (commit)
      from  1570523ad65216459341a574997a8349f3203117 (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 16a2ac1ad850b3d953878741aa1bc3ae790c59e9
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Jul 21 19:07:32 2025 +0200

    Do not pass a NULL pointer to lwrepalloc
    
    References #5947 in 3.2 branch (3.2.9dev)
    Includes regress test

diff --git a/NEWS b/NEWS
index 3e946a8df..5761d39f0 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Proj 4.9+ required.
 
 * Bug Fixes  *
 
+ - #5947, [topology] Fix crash in ST_ModEdgeHeal (Sandro Santilli)
  - #5925, #5946, [topology] Have GetFaceContainingPoint survive EMPTY edges (Sandro Santilli)
  - #5922, [topology] Fix crash in TopoGeo_AddLinestring with EMPTY input (Sandro Santilli)
  - #5908, [topology] Fix crash in GetFaceContainingPoint (Sandro Santilli)
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index d903d809d..9adf88f54 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -230,9 +230,17 @@ ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance)
 	ncap = pa1->npoints + npoints;
 	if ( pa1->maxpoints < ncap )
 	{
-		pa1->maxpoints = ncap > pa1->maxpoints*2 ?
-		                 ncap : pa1->maxpoints*2;
-		pa1->serialized_pointlist = lwrealloc(pa1->serialized_pointlist, ptsize * pa1->maxpoints);
+		if ( pa1->maxpoints )
+		{
+			pa1->maxpoints = ncap > pa1->maxpoints*2 ?
+			                 ncap : pa1->maxpoints*2;
+			pa1->serialized_pointlist = lwrealloc(pa1->serialized_pointlist, (size_t)ptsize * pa1->maxpoints);
+		}
+		else
+		{
+			pa1->maxpoints = ncap;
+			pa1->serialized_pointlist = lwalloc((size_t)ptsize * pa1->maxpoints);
+		}
 	}
 
 	memcpy(getPoint_internal(pa1, pa1->npoints),
diff --git a/topology/test/regress/st_modedgeheal.sql b/topology/test/regress/st_modedgeheal.sql
index b00c87eac..022b74986 100644
--- a/topology/test/regress/st_modedgeheal.sql
+++ b/topology/test/regress/st_modedgeheal.sql
@@ -225,6 +225,21 @@ SELECT '#1998.-', topology.DropTopology('t1998');
 -------------------------------------------------------------------------
 -------------------------------------------------------------------------
 
+-- Crash case
+-- See https://trac.osgeo.org/postgis/ticket/5947
+
+BEGIN;
+SELECT NULL FROM createTopology('t5947');
+SELECT NULL FROM TopoGeo_addLinestring('t5947', 'LINESTRING(10 0, 0 0)');
+SELECT NULL FROM TopoGeo_addLinestring('t5947', 'LINESTRING(20 0, 10 0)');
+UPDATE t5947.edge_data SET geom = 'LINESTRING EMPTY' WHERE edge_id = 2;
+SELECT 't5947', ST_ModEdgeHeal('t5947', 1, 2);
+ROLLBACK;
+
+-------------------------------------------------------------------------
+-------------------------------------------------------------------------
+-------------------------------------------------------------------------
+
 -- TODO: test registered but unexistent topology
 -- TODO: test registered but corrupted topology
 --       (missing node, edge, relation...)
diff --git a/topology/test/regress/st_modedgeheal_expected b/topology/test/regress/st_modedgeheal_expected
index 9dd640b15..2b4fbfbd8 100644
--- a/topology/test/regress/st_modedgeheal_expected
+++ b/topology/test/regress/st_modedgeheal_expected
@@ -151,3 +151,4 @@ Topology 't' dropped
 #1998.N-|2
 #1998.M2|LINESTRING(1 1,1 0,0 0,0 1,1 1)
 #1998.-|Topology 't1998' dropped
+t5947|1

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

Summary of changes:
 NEWS                                          |  1 +
 liblwgeom/ptarray.c                           | 14 +++++++++++---
 topology/test/regress/st_modedgeheal.sql      | 15 +++++++++++++++
 topology/test/regress/st_modedgeheal_expected |  1 +
 4 files changed, 28 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list