[SCM] PostGIS branch master updated. 3.7.0beta1-171-g7684171f72
git at osgeo.org
git at osgeo.org
Sun Aug 2 00:16:29 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, master has been updated
via 7684171f72b40191e6c7eea82a72a7aa0d83cbc2 (commit)
via c01ccdc82f1dde302aea7218587629dd3347c7b6 (commit)
from ad95178cf35dd18826561eb64a95a46b3b7ff5d7 (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 7684171f72b40191e6c7eea82a72a7aa0d83cbc2
Merge: ad95178cf3 c01ccdc82f
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date: Sun Aug 2 00:16:28 2026 -0700
Merge pull request 'Stop -Werror=stringop-overflow rejecting the malformed-NURBS unit test' (!642) from Komzpa/postgis:ci/fix-stringop-overflow-cunit-20260802 into master
The `pg14-geos310-gdal33-proj71` matrix cell on GitHub Actions fails on **every** open pull
request, and on none of their accounts — it fails on master:
cu_gserialized2.c: In function 'test_gserialized2_malformed_nurbs_degree':
cu_gserialized2.c:564:13: error: writing 4 bytes into a region of size 0 [-Werror=stringop-overflow=]
564 | payload[2] = 3; /* Three control points cannot support a degree-3 curve. */
make: *** [GNUmakefile:37: check-unit] Error 1
`test_gserialized2_malformed_nurbs_degree` deliberately corrupts a serialized NURBSCURVE's
degree field to prove the parser rejects it, writing through the pointer
`gserialized2_get_geometry_p` returns. GCC 10 sizes that region as zero, so an intentional,
in-bounds write reads as an overflow and `-Werror` makes it fatal.
Routing the pointer through a `noinline` helper leaves the object-size analysis nothing to
conclude. This deliberately does **not** suppress the diagnostic for the file — the rest of
`cu_gserialized2.c` keeps being checked — and does not change what the test asserts.
Verified inside the failing image itself (`postgis/postgis-build-env:pg14-geos310-gdal33-proj71`,
gcc 10.2.1): the error reproduces before the change, the compile exits 0 after it, and
`make -C liblwgeom check-unit` runs 50 suites and 5775 assertions with none failing, the
malformed-degree test among them.
Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/642
commit c01ccdc82f1dde302aea7218587629dd3347c7b6
Author: Darafei Praliaskouski <me at komzpa.net>
Date: Sun Aug 2 03:11:58 2026 +0400
Stop -Werror=stringop-overflow rejecting the malformed-NURBS test
The pg14-geos310-gdal33-proj71 CI cell fails on every pull request, and has
nothing to do with any of them. test_gserialized2_malformed_nurbs_degree
deliberately corrupts a serialized NURBSCURVE's degree field to prove the
parser rejects it, writing through the pointer gserialized2_get_geometry_p
returns. GCC 10 sizes that region as zero and reports the write as an
overflow:
cu_gserialized2.c:564:13: error: writing 4 bytes into a region of size 0
make: *** [GNUmakefile:37: check-unit] Error 1
The write is in bounds; the diagnostic is a false positive from the declared
shape of the trailing data member. Route the pointer through a noinline
helper so the object-size analysis has nothing to conclude, rather than
silencing the warning for the file — the rest of it should keep checking.
Reproduced and fixed inside the failing image itself
(postgis/postgis-build-env:pg14-geos310-gdal33-proj71, gcc 10.2.1): the
compile now exits 0, and check-unit runs 50 suites and 5775 assertions with
none failing, the malformed-degree test among them.
diff --git a/liblwgeom/cunit/cu_gserialized2.c b/liblwgeom/cunit/cu_gserialized2.c
index c02c5b2f83..c60b0f56b8 100644
--- a/liblwgeom/cunit/cu_gserialized2.c
+++ b/liblwgeom/cunit/cu_gserialized2.c
@@ -529,6 +529,20 @@ gserialized2_from_hexbytes(const char *hex)
static void assert_gserialized2_malformed_rejected(GSERIALIZED *g);
+#if defined(__GNUC__) || defined(__clang__)
+#define CUNIT_NOINLINE __attribute__((noinline))
+#else
+#define CUNIT_NOINLINE
+#endif
+
+static CUNIT_NOINLINE uint8_t *
+gserialized2_test_payload_p(GSERIALIZED *g)
+{
+ return (uint8_t *)(void *)gserialized2_get_geometry_p(g);
+}
+
+#undef CUNIT_NOINLINE
+
static void
test_gserialized2_malformed_collection_count(void)
{
@@ -552,16 +566,22 @@ test_gserialized2_malformed_nurbs_degree(void)
{
LWGEOM *lwgeom = lwgeom_from_wkt("NURBSCURVE(2, (0 0, 1 1, 2 0))", LW_PARSER_CHECK_NONE);
GSERIALIZED *g;
- uint32_t *payload;
+ uint8_t *payload;
+ uint32_t type;
+ uint32_t npoints;
+ uint32_t degree = 3;
CU_ASSERT_PTR_NOT_NULL_FATAL(lwgeom);
g = gserialized2_from_lwgeom(lwgeom, NULL);
CU_ASSERT_PTR_NOT_NULL_FATAL(g);
- payload = (uint32_t *)gserialized2_get_geometry_p(g);
- CU_ASSERT_EQUAL(payload[0], NURBSCURVETYPE);
- CU_ASSERT_EQUAL(payload[1], 3);
- payload[2] = 3; /* Three control points cannot support a degree-3 curve. */
+ payload = gserialized2_test_payload_p(g);
+ memcpy(&type, payload, sizeof(type));
+ memcpy(&npoints, payload + sizeof(uint32_t), sizeof(npoints));
+ CU_ASSERT_EQUAL(type, NURBSCURVETYPE);
+ CU_ASSERT_EQUAL(npoints, 3);
+ /* Three control points cannot support a degree-3 curve. */
+ memcpy(payload + 2 * sizeof(uint32_t), °ree, sizeof(degree));
assert_gserialized2_malformed_rejected(g);
-----------------------------------------------------------------------
Summary of changes:
liblwgeom/cunit/cu_gserialized2.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list