[SCM] PostGIS branch stable-3.1 updated. 3.1.11-45-g741aaa589
git at osgeo.org
git at osgeo.org
Wed Oct 8 14:20:54 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 741aaa5891fb8064cc40f29eceb0362289c5ba8f (commit)
from 147d127fff7667c1c2f915d6ef3f37c7ea60d8a0 (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 741aaa5891fb8064cc40f29eceb0362289c5ba8f
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 f13bcbcdc..43b7ffd47 100644
--- a/liblwgeom/measures.c
+++ b/liblwgeom/measures.c
@@ -273,6 +273,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
*/
@@ -310,6 +326,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;
@@ -327,6 +345,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");
@@ -524,26 +544,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