[SCM] PostGIS branch stable-3.4 updated. 3.4.4-39-g59d868631

git at osgeo.org git at osgeo.org
Tue Jul 22 02:59:04 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.4 has been updated
       via  59d868631813590b6c0cb7540a9ff7aede98ae5d (commit)
      from  3435376e3842c16f86869c54348966ea39c2d97c (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 59d868631813590b6c0cb7540a9ff7aede98ae5d
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.4 branch (3.4.5dev)
    Includes regress test

diff --git a/NEWS b/NEWS
index aeb6b5d4e..4d1320fb6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Proj 6.1+ required.
 
 * Bug Fixes *
 
+  - #5947, [topology] Fix crash in ST_ModEdgeHeal (Sandro Santilli)
   - #5925, #5946, [topology] Have GetFaceContainingPoint survive EMPTY edges (Sandro Santilli)
   - #5936, [topology] Do script-based upgrade in a single transaction (Sandro Santilli)
   - #5922, [topology] Fix crash in TopoGeo_AddLinestring with EMPTY input (Sandro Santilli)
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index c8fede189..3eaf417b2 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 628c470d7..43a4204cf 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