[SCM] PostGIS branch stable-3.0 updated. 3.0.11-20-g58ef17e4f

git at osgeo.org git at osgeo.org
Wed Oct 8 14:21:03 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  58ef17e4fc45651f8b3e92ea9cefc34942f35e71 (commit)
      from  98992aa72c3358aff5fc6ee4f30984c8f2a289e4 (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 58ef17e4fc45651f8b3e92ea9cefc34942f35e71
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Oct 8 14:17:23 2025 -0700

    Avoid possible null pointer dereference. Closes #6000

diff --git a/liblwgeom/measures.c b/liblwgeom/measures.c
index ac2ddac46..eb95ef750 100644
--- a/liblwgeom/measures.c
+++ b/liblwgeom/measures.c
@@ -261,6 +261,22 @@ lw_dist2d_is_collection(const LWGEOM *g)
 	}
 }
 
+
+/* Check for overlapping bboxes */
+static int
+lw_dist2d_check_overlap(const LWGEOM *lwg1, const LWGEOM *lwg2)
+{
+	assert(lwg1 && lwg2 && lwg1->bbox && lwg2->bbox);
+
+	/* Check if the geometries intersect. */
+	if ((lwg1->bbox->xmax < lwg2->bbox->xmin || lwg1->bbox->xmin > lwg2->bbox->xmax ||
+	     lwg1->bbox->ymax < lwg2->bbox->ymin || lwg1->bbox->ymin > lwg2->bbox->ymax))
+	{
+		return LW_FALSE;
+	}
+	return LW_TRUE;
+}
+
 /**
 This is a recursive function delivering every possible combination of subgeometries
 */
@@ -298,6 +314,8 @@ lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
 		else
 			g1 = (LWGEOM *)lwg1;
 
+		if (!g1) continue;
+
 		if (lwgeom_is_empty(g1))
 			continue;
 
@@ -315,6 +333,8 @@ lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
 			else
 				g2 = (LWGEOM *)lwg2;
 
+			if (!g2) continue;
+
 			if (lw_dist2d_is_collection(g2))
 			{
 				LWDEBUG(3, "Found collection inside second geometry collection, recursing");
@@ -512,26 +532,6 @@ lw_dist2d_distribute_bruteforce(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS
 	return LW_FALSE;
 }
 
-/* Check for overlapping bboxes */
-int
-lw_dist2d_check_overlap(LWGEOM *lwg1, LWGEOM *lwg2)
-{
-	LWDEBUG(2, "lw_dist2d_check_overlap is called");
-	if (!lwg1->bbox)
-		lwgeom_calculate_gbox(lwg1, lwg1->bbox);
-	if (!lwg2->bbox)
-		lwgeom_calculate_gbox(lwg2, lwg2->bbox);
-
-	/* Check if the geometries intersect. */
-	if ((lwg1->bbox->xmax < lwg2->bbox->xmin || lwg1->bbox->xmin > lwg2->bbox->xmax ||
-	     lwg1->bbox->ymax < lwg2->bbox->ymin || lwg1->bbox->ymin > lwg2->bbox->ymax))
-	{
-		LWDEBUG(3, "geometries bboxes did not overlap");
-		return LW_FALSE;
-	}
-	LWDEBUG(3, "geometries bboxes overlap");
-	return LW_TRUE;
-}
 
 /** Geometries are distributed for the new faster distance-calculations */
 int
diff --git a/liblwgeom/measures.h b/liblwgeom/measures.h
index 9cf0fb958..fc3f34bfe 100644
--- a/liblwgeom/measures.h
+++ b/liblwgeom/measures.h
@@ -69,7 +69,6 @@ typedef struct
 int lw_dist2d_comp(const LWGEOM *lw1, const LWGEOM *lw2, DISTPTS *dl);
 int lw_dist2d_distribute_bruteforce(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl);
 int lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl);
-int lw_dist2d_check_overlap(LWGEOM *lwg1, LWGEOM *lwg2);
 int lw_dist2d_distribute_fast(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl);
 
 /*

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

Summary of changes:
 liblwgeom/measures.c | 40 ++++++++++++++++++++--------------------
 liblwgeom/measures.h |  1 -
 2 files changed, 20 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list