[postgis-tickets] [SCM] PostGIS branch stable-3.3 updated. 3.3.2-11-g69900affe
git at osgeo.org
git at osgeo.org
Mon Jan 30 08:25:22 PST 2023
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.3 has been updated
via 69900affe41cb654941e58300829efe352e9a3e1 (commit)
from 12df1cfd409d85d5a42dcd4c0e17f9603a6d5bb5 (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 69900affe41cb654941e58300829efe352e9a3e1
Author: Sandro Santilli <strk at kbt.io>
Date: Mon Jan 30 14:41:02 2023 +0100
Fix segfault in _lwt_RemEdge when no edge side-faces are found
References #5106 in 3.3 branch (3.3.3dev)
Includes regress tests
diff --git a/NEWS b/NEWS
index ee0b1b2e2..9b1deb9fd 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ YYYY/MM/DD
doubly connected edges healing (Sandro Santilli)
- #5298, Fix CopyTopology exception with hierarchical layers (Sandro Santilli)
- #5299, Corrections to address_standardizer_data_us lex (Regina Obe)
+ - #5106, Fix segfault in ST_RemEdgeNewFace/ST_RemEdgeModFace
+ when no edge side-faces are found (Sandro Santilli)
PostGIS 3.3.2
2022/11/12
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 5988e5a67..7ecc5e430 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -4049,7 +4049,7 @@ _lwt_RemEdge( LWT_TOPOLOGY* topo, LWT_ELEMID edge_id, int modFace )
if ( ! box1 ) {
i = edge->face_left;
_lwt_release_edges(edge, 1);
- _lwt_release_faces(faces, nfaces);
+ if ( nfaces ) _lwt_release_faces(faces, nfaces);
lwerror("corrupted topology: no face have face_id=%"
LWTFMT_ELEMID " (left face for edge %"
LWTFMT_ELEMID ")", i, edge_id);
@@ -4058,7 +4058,7 @@ _lwt_RemEdge( LWT_TOPOLOGY* topo, LWT_ELEMID edge_id, int modFace )
if ( ! box2 ) {
i = edge->face_right;
_lwt_release_edges(edge, 1);
- _lwt_release_faces(faces, nfaces);
+ if ( nfaces ) _lwt_release_faces(faces, nfaces);
lwerror("corrupted topology: no face have face_id=%"
LWTFMT_ELEMID " (right face for edge %"
LWTFMT_ELEMID ")", i, edge_id);
diff --git a/topology/test/regress/st_remedgemodface.sql b/topology/test/regress/st_remedgemodface.sql
index 320571da2..1686f1d3f 100644
--- a/topology/test/regress/st_remedgemodface.sql
+++ b/topology/test/regress/st_remedgemodface.sql
@@ -414,7 +414,40 @@ DROP SCHEMA features CASCADE;
-------------------------------------------------------------------------
-------------------------------------------------------------------------
--- clean up
+
+-------------------------------------------------------------------------
+-- Test for https://trac.osgeo.org/postgis/ticket/5106
+-------------------------------------------------------------------------
+
+BEGIN;
+SELECT NULL FROM topology.CreateTopology('t5106');
+INSERT INTO t5106.node VALUES ( 1, NULL, 'POINT(0 0)' );
+-- Cannot reference non-existing faces w/out dropping
+-- these constraints
+ALTER TABLE t5106.edge_data DROP constraint left_face_exists;
+ALTER TABLE t5106.edge_data DROP constraint right_face_exists;
+INSERT INTO t5106.edge VALUES
+(
+ 1, -- edge_id
+ 1, 1, -- start/end node
+ 1, -1, -- next left/right edge
+ 1, 2, -- left/right faces (different, both non-0 and non existent)
+ 'LINESTRING(0 0,10 0,10 10,0 0)'
+);
+DO $BODY$
+BEGIN
+ PERFORM ST_RemEdgeModFace('t5106', 1);
+ RAISE EXCEPTION '#5106 failed throwing an exception';
+EXCEPTION WHEN OTHERS THEN
+ RAISE EXCEPTION '#5106 threw: %', SQLERRM;
+END;
+$BODY$ LANGUAGE 'plpgsql';
+ROLLBACK;
+
+----------------------------
+-- Clean up
+----------------------------
+
DROP FUNCTION save_edges();
DROP FUNCTION check_edges(text);
DROP FUNCTION save_faces();
diff --git a/topology/test/regress/st_remedgemodface_expected b/topology/test/regress/st_remedgemodface_expected
index 3ae4345d8..dc76f3452 100644
--- a/topology/test/regress/st_remedgemodface_expected
+++ b/topology/test/regress/st_remedgemodface_expected
@@ -194,3 +194,4 @@ RM(11)|P3|t
RM(11)|P4|t
RM(11)|P5|t
Topology 'city_data' dropped
+ERROR: #5106 threw: corrupted topology: no face have face_id=1 (left face for edge 1)
diff --git a/topology/test/regress/st_remedgenewface.sql b/topology/test/regress/st_remedgenewface.sql
index ebaa42207..1f1bfd6cb 100644
--- a/topology/test/regress/st_remedgenewface.sql
+++ b/topology/test/regress/st_remedgenewface.sql
@@ -414,7 +414,39 @@ DROP SCHEMA features CASCADE;
-------------------------------------------------------------------------
-------------------------------------------------------------------------
--- clean up
+-------------------------------------------------------------------------
+-- Test for https://trac.osgeo.org/postgis/ticket/5106
+-------------------------------------------------------------------------
+
+BEGIN;
+SELECT NULL FROM topology.CreateTopology('t5106');
+INSERT INTO t5106.node VALUES ( 1, NULL, 'POINT(0 0)' );
+-- Cannot reference non-existing faces w/out dropping
+-- these constraints
+ALTER TABLE t5106.edge_data DROP constraint left_face_exists;
+ALTER TABLE t5106.edge_data DROP constraint right_face_exists;
+INSERT INTO t5106.edge VALUES
+(
+ 1, -- edge_id
+ 1, 1, -- start/end node
+ 1, -1, -- next left/right edge
+ 1, 2, -- left/right faces (different, both non-0 and non existent)
+ 'LINESTRING(0 0,10 0,10 10,0 0)'
+);
+DO $BODY$
+BEGIN
+ PERFORM topology.ST_RemEdgeNewFace('t5106', 1);
+ RAISE EXCEPTION '#5106 failed throwing an exception';
+EXCEPTION WHEN OTHERS THEN
+ RAISE EXCEPTION '#5106 threw: %', SQLERRM;
+END;
+$BODY$ LANGUAGE 'plpgsql';
+ROLLBACK;
+
+----------------------------
+-- Clean up
+----------------------------
+
DROP FUNCTION save_edges();
DROP FUNCTION check_edges(text);
DROP FUNCTION save_faces();
diff --git a/topology/test/regress/st_remedgenewface_expected b/topology/test/regress/st_remedgenewface_expected
index 96eb15131..279e74c78 100644
--- a/topology/test/regress/st_remedgenewface_expected
+++ b/topology/test/regress/st_remedgenewface_expected
@@ -224,3 +224,4 @@ RN(11)|P3|t
RN(11)|P4|t
RN(11)|P5|t
Topology 'city_data' dropped
+ERROR: #5106 threw: corrupted topology: no face have face_id=1 (left face for edge 1)
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 ++
liblwgeom/lwgeom_topo.c | 4 +--
topology/test/regress/st_remedgemodface.sql | 35 +++++++++++++++++++++++-
topology/test/regress/st_remedgemodface_expected | 1 +
topology/test/regress/st_remedgenewface.sql | 34 ++++++++++++++++++++++-
topology/test/regress/st_remedgenewface_expected | 1 +
6 files changed, 73 insertions(+), 4 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list