[SCM] PostGIS branch master updated. 3.6.0rc2-127-gc57e094f7
git at osgeo.org
git at osgeo.org
Wed Oct 8 14:20:08 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, master has been updated
via c57e094f73819eee5ffea672ee185c391e655ffe (commit)
from 0383bab91e5f2eb7ac418fc661d473d3b87f5330 (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 c57e094f73819eee5ffea672ee185c391e655ffe
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 62e2a3586..cc3ea6800 100644
--- a/liblwgeom/measures.c
+++ b/liblwgeom/measures.c
@@ -276,6 +276,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
*/
@@ -313,6 +329,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;
@@ -330,6 +348,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");
@@ -529,26 +549,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