[SCM] PostGIS branch stable-3.0 updated. 3.0.11-17-g9b97c754d
git at osgeo.org
git at osgeo.org
Tue Jul 22 03:07:31 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.0 has been updated
via 9b97c754d15fd3852f593b54656a326a33d83c5f (commit)
from 7021871bda202171b44a3bab975b194987c98d1a (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 9b97c754d15fd3852f593b54656a326a33d83c5f
Author: Sandro Santilli <strk at kbt.io>
Date: Mon Jul 21 19:07:32 2025 +0200
Do not pass a NULL pointer to lwrepalloc
Closes #5947 in 3.0 branch (3.0.12dev)
Includes regress test
diff --git a/NEWS b/NEWS
index eddf73244..4206b0a19 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Proj 4.9+ required.
* Bug Fixes *
+ - #5947, [topology] Fix crash in ST_ModEdgeHeal (Sandro Santilli)
- #5922, [topology] Fix crash in TopoGeo_AddLinestring with EMPTY input (Sandro Santilli)
- #5907, [topology] Fix crash in TopoGeo_AddPolygon with EMPTY input (Sandro Santilli)
- #5795, [topology] Fix ST_NewEdgesSplit can cause invalid topology (Björn Harrtell)
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 65a50fcbe..e1d5fdf90 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 83229926d..6b126db9e 100644
--- a/topology/test/regress/st_modedgeheal.sql
+++ b/topology/test/regress/st_modedgeheal.sql
@@ -179,6 +179,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 e55d77744..8a4220c71 100644
--- a/topology/test/regress/st_modedgeheal_expected
+++ b/topology/test/regress/st_modedgeheal_expected
@@ -146,3 +146,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