[SCM] PostGIS branch stable-3.1 updated. 3.1.11-39-g9d3757ef7
git at osgeo.org
git at osgeo.org
Tue Jul 22 03:06:46 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 9d3757ef72add3bff06e0bbac94452c83deba719 (commit)
from 4282bb2830eb833f2c232cb08ada94273f1c11f4 (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 9d3757ef72add3bff06e0bbac94452c83deba719
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.1 branch (3.1.13dev)
Includes regress test
diff --git a/NEWS b/NEWS
index 98ab01c68..3db3011c7 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ YYYY/MM/DD
* 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)
- #5876, Fix ST_AddPoint with empty point argument (Paul Ramsey)
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 38cfa5c65..7fbdccb5d 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