[SCM] PostGIS branch stable-3.6 updated. 3.6.4-96-g758674f6ca
git at osgeo.org
git at osgeo.org
Mon Jul 27 16:42:43 PDT 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, stable-3.6 has been updated
via 758674f6cab130bfc581591ea8a3784e6abd513e (commit)
via 82e9c05e0f76d14ff7f0900f9ee09fddbfc82ec6 (commit)
from 36d54ddb553302694397c2c4dfae20c13eaa326a (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 758674f6cab130bfc581591ea8a3784e6abd513e
Merge: 36d54ddb55 82e9c05e0f
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date: Mon Jul 27 16:42:42 2026 -0700
Merge pull request 'Backport ST_MakePolygon NULL-hole fix to stable-3.6' (!565) from Komzpa/postgis:fix/makepolygon-null-holes-stable-3.6 into stable-3.6
Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/565
commit 82e9c05e0f76d14ff7f0900f9ee09fddbfc82ec6
Author: Darafei Praliaskouski <me at komzpa.net>
Date: Tue Jul 28 01:48:53 2026 +0400
Fix ST_MakePolygon with NULL holes
Ported-from: https://gitea.osgeo.org/postgis/postgis/commit/822431278881b7eed51534c0c9991bb0a2883942
diff --git a/NEWS b/NEWS
index 2fe473c21a..cb4d25c214 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,8 @@ PostGIS 3.6.5
noding lines with GEOS main (Darafei Praliaskouski)
- GT-493, Fix 32-bit topology and coverage crashes
(Darafei Praliaskouski)
+- GT-564, Avoid ST_MakePolygon failures with NULL hole array entries
+ (Darafei Praliaskouski)
PostGIS 3.6.4
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index e4900c943d..9a7a1b898c 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -1562,8 +1562,8 @@ Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
const LWLINE **holes = NULL;
LWPOLY *outpoly;
uint32 nholes = 0;
+ uint32 nitems = 0;
uint32 i;
- size_t offset = 0;
POSTGIS_DEBUG(2, "LWGEOM_makepoly called.");
@@ -1578,28 +1578,31 @@ Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
/* Get input holes if any */
if (PG_NARGS() > 1)
{
+ ArrayIterator iterator;
+ Datum value;
+ bool isnull;
+
array = PG_GETARG_ARRAYTYPE_P(1);
- nholes = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
- holes = lwalloc(sizeof(LWLINE *) * nholes);
- for (i = 0; i < nholes; i++)
+ nitems = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
+ holes = lwalloc(sizeof(LWLINE *) * nitems);
+ iterator = array_create_iterator(array, 0, NULL);
+ while (array_iterate(iterator, &value, &isnull))
{
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
- GSERIALIZED *g = (GSERIALIZED *)(ARR_DATA_PTR(array) + offset);
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#pragma GCC diagnostic pop
-#endif
+ GSERIALIZED *g;
LWLINE *hole;
- offset += INTALIGN(VARSIZE(g));
+
+ if (isnull)
+ continue;
+
+ g = (GSERIALIZED *)DatumGetPointer(value);
if (gserialized_get_type(g) != LINETYPE)
{
- lwpgerror("Hole %d is not a line", i);
+ lwpgerror("Hole %d is not a line", nholes);
}
hole = lwgeom_as_lwline(lwgeom_from_gserialized(g));
- holes[i] = hole;
+ holes[nholes++] = hole;
}
+ array_free_iterator(iterator);
}
outpoly = lwpoly_from_lwlines(shell, nholes, holes);
@@ -1613,6 +1616,8 @@ Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
{
lwline_free((LWLINE *)holes[i]);
}
+ if (holes)
+ lwfree(holes);
PG_RETURN_POINTER(result);
}
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index d6e7c3ff08..b6262f56f4 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1619,3 +1619,8 @@ DROP TABLE IF EXISTS test5829, test5978;
-- #5357
SELECT '#5357', ST_AsText(ST_LineFromEncodedPolyline('__nphBgcoeiA?@', 6), 6);
+
+-- ST_MakePolygon with NULL holes
+SELECT 'makepolygon-null-holes', ST_NPoints(ST_MakePolygon(
+ 'LINESTRING ZM (0 0 0 0,0 1 0 0,1 1 0 0,0 0 0 0)'::geometry,
+ ARRAY[NULL::geometry]));
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index f32849f0a6..05868a0cc8 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -491,3 +491,4 @@ public|test5829|geom|2|4326|GEOMETRY
public|test5978|geometry|2|4326|POINT
public|test5978|shape|2|4326|POINT
#5357|LINESTRING(38.903876 55.336448,38.903875 55.336448)
+makepolygon-null-holes|4
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 ++
postgis/lwgeom_functions_basic.c | 35 ++++++++++++++++++++---------------
regress/core/tickets.sql | 5 +++++
regress/core/tickets_expected | 1 +
4 files changed, 28 insertions(+), 15 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list