[SCM] PostGIS branch master updated. 3.6.0rc2-280-g3a6b9e454

git at osgeo.org git at osgeo.org
Tue Jan 13 03:56:43 PST 2026


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, master has been updated
       via  3a6b9e454c1ce9a53f14ad87fefcf8cf2ee1ad33 (commit)
      from  76123f9f6e9653e7f7cce728046b42da1fc1ff03 (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 3a6b9e454c1ce9a53f14ad87fefcf8cf2ee1ad33
Author: Sandro Santilli <strk at kbt.io>
Date:   Tue Jan 13 12:05:57 2026 +0100

    Fix robustness issue in ptarray_contains_point
    
    References #6023 in master branch (3.7.0dev)
    
    Includes unit and regress tests

diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c
index 99c689ac2..6d8ea2faa 100644
--- a/liblwgeom/cunit/cu_ptarray.c
+++ b/liblwgeom/cunit/cu_ptarray.c
@@ -426,6 +426,17 @@ static void test_ptarray_contains_point()
 	rv = ptarray_contains_point(pa, &pt);
 	CU_ASSERT_EQUAL(rv, LW_INSIDE);
 
+	lwline_free(lwline);
+
+
+	/* Test for https://trac.osgeo.org/postgis/ticket/6023 */
+	lwline = lwgeom_as_lwline(lwgeom_from_text("LINESTRING(11.230120879533454 62.84897119848748,11.230120879533905 62.8489711984873,11.23020501303477 62.84900750109812,11.230170431987244 62.84904481447776,11.230117909393426 62.8489943480894,11.230120879533454 62.84897119848748)"));
+	pa = lwline->points;
+	pt = getPoint2d(lwline->points, 0);
+	rv = ptarray_contains_point(pa, &pt);
+	ASSERT_INT_EQUAL(rv, LW_BOUNDARY);
+
+
 	lwline_free(lwline);
 }
 
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index cce30d5b2..9a73230f8 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -768,6 +768,12 @@ ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt)
 
 		seg2 = getPoint2d_cp(pa, i);
 
+		/* This is required for robustness, see #6023 */
+		if (p2d_same(seg1, pt))
+		{
+			return LW_BOUNDARY;
+		}
+
 		/* Zero length segments are ignored. */
 		if (p2d_same(seg1, seg2))
 		{
diff --git a/topology/test/regress/topogeo_addlinestring.sql b/topology/test/regress/topogeo_addlinestring.sql
index 07465dab9..50c716b6b 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -589,3 +589,27 @@ SELECT '#5993.4', 'snap-split-off-limit', * FROM topology.TopoGeo_addLinestring(
   tolerance => 2
 );
 SELECT NULL FROM topology.DropTopology ('t5993');
+
+
+
+-- See https://trac.osgeo.org/postgis/ticket/6023
+SELECT NULL FROM topology.CreateTopology ('t6023');
+SELECT NULL FROM topology.TopoGeo_addLinestring('t6023',
+  'LINESTRING(
+    11.230021066287687 62.84898276648437,
+    11.230170431987244 62.84904481447776,
+    11.230117909393426 62.8489943480894,
+    11.230121356631185 62.848967479934664,
+    11.230021066287687 62.84898276648437
+  )',-1);
+SELECT 't6023.1', 'errors', (array_agg(v.error))[1] FROM topology.ValidateTopology('t6023') v;
+SELECT NULL FROM topology.TopoGeo_addLinestring('t6023',
+    'LINESTRING(
+       11.230170431987244 62.84904481447776,
+       11.23020501303477 62.84900750109812,
+       11.230120879533905 62.8489711984873,
+       11.230120879533454 62.84897119848748
+    )', 0);
+SELECT 't6023.2', 'errors', (array_agg(v.error))[1] FROM topology.ValidateTopology('t6023') v;
+SELECT NULL FROM topology.DropTopology ('t6023');
+
diff --git a/topology/test/regress/topogeo_addlinestring_expected b/topology/test/regress/topogeo_addlinestring_expected
index a9ecae7b9..f80416f71 100644
--- a/topology/test/regress/topogeo_addlinestring_expected
+++ b/topology/test/regress/topogeo_addlinestring_expected
@@ -233,3 +233,5 @@ ERROR:  Adding line to topology requires creating more edges than the requested
 ERROR:  Adding line to topology requires creating more edges than the requested limit of 1
 #5993.3|double-split-in-limit|1
 ERROR:  Adding line to topology requires creating more edges than the requested limit of 1
+t6023.1|errors|
+t6023.2|errors|

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

Summary of changes:
 liblwgeom/cunit/cu_ptarray.c                       | 11 ++++++++++
 liblwgeom/ptarray.c                                |  6 ++++++
 topology/test/regress/topogeo_addlinestring.sql    | 24 ++++++++++++++++++++++
 .../test/regress/topogeo_addlinestring_expected    |  2 ++
 4 files changed, 43 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list