[SCM] PostGIS branch stable-3.6 updated. 3.6.2-23-gf02a7536c
git at osgeo.org
git at osgeo.org
Mon Apr 13 11:12:16 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 f02a7536cb3597d2db400fdd0e4747f03e29b6e2 (commit)
via 44ac9bc46984fd649ebdc9076aecd0e678136314 (commit)
via 16d388906c641f702d5e5c669f311e59103ed216 (commit)
via 7372f89acd938ff9c6f46d2822b34b4089d5d07c (commit)
via af79a7a0cb8d5e9219f4c3bfcca64fbc0b927eb0 (commit)
via 72c3a7a5e7006c228e796324087be3c117793ea1 (commit)
via 4c85dfa2c69fcdc12cd428f033529301908ca251 (commit)
via 75254c60697241cd8a8804bbc37feb9a0a1890f1 (commit)
via fa01f2bdc0b17b84000198df12b44ac4ed6dd1da (commit)
from bf475b54959c3605055e783496f3d8474d696e9e (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 f02a7536cb3597d2db400fdd0e4747f03e29b6e2
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon Apr 13 11:11:52 2026 -0700
Catch all FALLTHROUGH cases in a standard way,
move to strict K&R style prototypes for functions
with no arguments, cleans up warnings in recent compilers
References #6069
diff --git a/NEWS b/NEWS
index 1d69eb34d..022ab4bea 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ topogeometry corruption:
- #6060, fully quality calls to helper functions (Paul Ramsey)
- #6026, KNN failure in rare IEEE double rounding case (Paul Ramsey)
- #6061, WKT parser produces incorrect error locations (Paul Ramsey)
+- #6069, Build warnings / CI failures on K&R style, fallthroughs (Paul Ramsey)
PostGIS 3.6.2
diff --git a/deps/uthash/include/uthash.h b/deps/uthash/include/uthash.h
index af0546472..ecb883871 100644
--- a/deps/uthash/include/uthash.h
+++ b/deps/uthash/include/uthash.h
@@ -136,6 +136,23 @@ typedef unsigned char uint8_t;
#endif
+#ifndef FALLTHROUGH
+ #if defined(__cplusplus) && __cplusplus >= 201703L
+ #define FALLTHROUGH [[fallthrough]]
+ #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+ #define FALLTHROUGH [[fallthrough]]
+ #elif defined(__clang__)
+ #define FALLTHROUGH __attribute__((fallthrough))
+ #elif defined(__GNUC__) && __GNUC__ >= 7
+ #define FALLTHROUGH __attribute__((fallthrough))
+ #elif defined(_MSC_VER) && _MSC_VER >= 1910
+ #define FALLTHROUGH [[fallthrough]]
+ #else
+ #define FALLTHROUGH ((void)0)
+ #endif
+#endif
+
+
/* initial number of buckets */
#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */
#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */
@@ -681,16 +698,16 @@ do {
} \
hashv += (unsigned)(keylen); \
switch ( _hj_k ) { \
- case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); /* FALLTHROUGH */ \
- case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); /* FALLTHROUGH */ \
- case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); /* FALLTHROUGH */ \
- case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); /* FALLTHROUGH */ \
- case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); /* FALLTHROUGH */ \
- case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); /* FALLTHROUGH */ \
- case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \
- case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); /* FALLTHROUGH */ \
- case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); /* FALLTHROUGH */ \
- case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); /* FALLTHROUGH */ \
+ case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); FALLTHROUGH; \
+ case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); FALLTHROUGH; \
+ case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); FALLTHROUGH; \
+ case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); FALLTHROUGH; \
+ case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); FALLTHROUGH; \
+ case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); FALLTHROUGH; \
+ case 5: _hj_j += _hj_key[4]; FALLTHROUGH; \
+ case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); FALLTHROUGH; \
+ case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); FALLTHROUGH; \
+ case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); FALLTHROUGH; \
case 1: _hj_i += _hj_key[0]; \
} \
HASH_JEN_MIX(_hj_i, _hj_j, hashv); \
@@ -1224,4 +1241,4 @@ typedef struct UT_hash_handle {
unsigned hashv; /* result of hash-fcn(key) */
} UT_hash_handle;
-#endif /* UTHASH_H */
\ No newline at end of file
+#endif /* UTHASH_H */
diff --git a/deps/wagyu/lwgeom_wagyu.cpp b/deps/wagyu/lwgeom_wagyu.cpp
index 0afbd144b..fc6e359c6 100644
--- a/deps/wagyu/lwgeom_wagyu.cpp
+++ b/deps/wagyu/lwgeom_wagyu.cpp
@@ -250,7 +250,7 @@ lwgeom_wagyu_clip_by_box(const LWGEOM *geom, const GBOX *bbox)
}
const char *
-libwagyu_version()
+libwagyu_version(void)
{
static char str[50] = {0};
snprintf(
@@ -260,13 +260,13 @@ libwagyu_version()
}
void
-lwgeom_wagyu_interruptRequest()
+lwgeom_wagyu_interruptRequest(void)
{
mapbox::geometry::wagyu::interrupt_request();
}
void
-lwgeom_wagyu_interruptReset()
+lwgeom_wagyu_interruptReset(void)
{
mapbox::geometry::wagyu::interrupt_reset();
}
diff --git a/deps/wagyu/lwgeom_wagyu.h b/deps/wagyu/lwgeom_wagyu.h
index 9e557f679..52963e23a 100644
--- a/deps/wagyu/lwgeom_wagyu.h
+++ b/deps/wagyu/lwgeom_wagyu.h
@@ -52,17 +52,17 @@ LWGEOM *lwgeom_wagyu_clip_by_box(const LWGEOM *geom, const GBOX *bbox);
* Returns a pointer to the static string representing the Wagyu release
* being used (Should not be freed)
*/
-const char *libwagyu_version();
+const char *libwagyu_version(void);
/**
* Requests wagyu to stop processing. In this case it will return NULL
*/
-void lwgeom_wagyu_interruptRequest();
+void lwgeom_wagyu_interruptRequest(void);
/**
* Cancels request to stop processing.
*/
-void lwgeom_wagyu_interruptReset();
+void lwgeom_wagyu_interruptReset(void);
#ifdef __cplusplus
}
diff --git a/extensions/address_standardizer/khash.h b/extensions/address_standardizer/khash.h
index 09d817013..398df18a0 100644
--- a/extensions/address_standardizer/khash.h
+++ b/extensions/address_standardizer/khash.h
@@ -116,7 +116,7 @@ static const double __ac_HASH_UPPER = 0.77;
khkey_t *keys; \
khval_t *vals; \
} kh_##name##_t; \
- static inline kh_##name##_t *kh_init_##name() { \
+ static inline kh_##name##_t *kh_init_##name(void) { \
return (kh_##name##_t*)calloc(1,sizeof(kh_##name##_t)); \
} \
static inline void kh_destroy_##name(kh_##name##_t *h) \
@@ -276,7 +276,7 @@ static inline khint_t __ac_X31_hash_string(const char *s)
#define khash_t(name) kh_##name##_t
-#define kh_init(name) kh_init_##name()
+#define kh_init(name) kh_init_##name(void)
#define kh_destroy(name, h) kh_destroy_##name(h)
#define kh_clear(name, h) kh_clear_##name(h)
#define kh_resize(name, h, s) kh_resize_##name(h, s)
diff --git a/extensions/address_standardizer/parseaddress-api.c b/extensions/address_standardizer/parseaddress-api.c
index dd37c277b..1e21e235c 100644
--- a/extensions/address_standardizer/parseaddress-api.c
+++ b/extensions/address_standardizer/parseaddress-api.c
@@ -43,7 +43,7 @@
#endif
const char *get_state_regex(char *st);
-const char *parseaddress_cvsid();
+const char *parseaddress_cvsid(void);
char *clean_leading_punct(char *s);
const char *get_state_regex(char *st)
diff --git a/extensions/address_standardizer/standard.c b/extensions/address_standardizer/standard.c
index 9fed23411..07c3348c4 100644
--- a/extensions/address_standardizer/standard.c
+++ b/extensions/address_standardizer/standard.c
@@ -314,7 +314,7 @@ typedef struct STDADDR_s { // define as required
*/
-STANDARDIZER *std_init()
+STANDARDIZER *std_init(void)
{
STANDARDIZER *std;
diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c
index 6d8ea2faa..8cf3d8c11 100644
--- a/liblwgeom/cunit/cu_ptarray.c
+++ b/liblwgeom/cunit/cu_ptarray.c
@@ -314,7 +314,7 @@ static void test_ptarray_isccw(void)
lwpoly_free(poly);
}
-static void test_ptarray_signed_area()
+static void test_ptarray_signed_area(void)
{
LWLINE *line;
double area;
@@ -340,7 +340,7 @@ static void test_ptarray_signed_area()
}
-static void test_ptarray_contains_point()
+static void test_ptarray_contains_point(void)
{
/* int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt, int *winding_number) */
@@ -440,7 +440,7 @@ static void test_ptarray_contains_point()
lwline_free(lwline);
}
-static void test_ptarrayarc_contains_point()
+static void test_ptarrayarc_contains_point(void)
{
/* int ptarrayarc_contains_point(const POINTARRAY *pa, const POINT2D *pt) */
@@ -578,7 +578,7 @@ static void test_ptarrayarc_contains_point()
lwcircstring_free(lwcirc);
}
-static void test_ptarray_scale()
+static void test_ptarray_scale(void)
{
LWLINE *line;
POINTARRAY *pa;
@@ -627,7 +627,7 @@ static void test_ptarray_scale()
lwline_free(line);
}
-static void test_ptarray_scroll()
+static void test_ptarray_scroll(void)
{
LWLINE *line;
POINTARRAY *pa;
@@ -664,7 +664,7 @@ static void test_ptarray_scroll()
lwline_free(line);
}
-static void test_ptarray_closest_vertex_2d()
+static void test_ptarray_closest_vertex_2d(void)
{
LWLINE *line;
POINTARRAY *pa;
@@ -696,7 +696,7 @@ static void test_ptarray_closest_vertex_2d()
lwline_free(line);
}
-static void test_ptarray_closest_segment_2d()
+static void test_ptarray_closest_segment_2d(void)
{
LWLINE *line;
POINTARRAY *pa;
diff --git a/liblwgeom/cunit/cu_remove_irrelevant_points_for_view.c b/liblwgeom/cunit/cu_remove_irrelevant_points_for_view.c
index b3bbcbcd0..84be8a36a 100644
--- a/liblwgeom/cunit/cu_remove_irrelevant_points_for_view.c
+++ b/liblwgeom/cunit/cu_remove_irrelevant_points_for_view.c
@@ -15,7 +15,7 @@
#include "lwgeom_remove_irrelevant_points_for_view.h"
-// test case for lwgeom_remove_irrelevant_points_for_view()
+
static void test_lwgeom_remove_irrelevant_points_for_view(void)
{
LWGEOM *geom;
diff --git a/liblwgeom/cunit/cu_tester.c b/liblwgeom/cunit/cu_tester.c
index 0df215893..708b8070c 100644
--- a/liblwgeom/cunit/cu_tester.c
+++ b/liblwgeom/cunit/cu_tester.c
@@ -30,12 +30,12 @@ cu_debuglogger(int level, const char *fmt, va_list ap);
/* ADD YOUR SUITE SETUP FUNCTION HERE (1 of 2) */
-extern void print_suite_setup();
-extern void algorithms_suite_setup();
-extern void boundary_suite_setup();
-extern void buildarea_suite_setup();
-extern void clean_suite_setup();
-extern void clip_by_rect_suite_setup();
+extern void print_suite_setup(void);
+extern void algorithms_suite_setup(void);
+extern void boundary_suite_setup(void);
+extern void buildarea_suite_setup(void);
+extern void clean_suite_setup(void);
+extern void clip_by_rect_suite_setup(void);
extern void force_dims_suite_setup(void);
extern void force_sfs_suite_setup(void);
extern void geodetic_suite_setup(void);
diff --git a/liblwgeom/liblwgeom_internal.h b/liblwgeom/liblwgeom_internal.h
index 610807120..48c591a59 100644
--- a/liblwgeom/liblwgeom_internal.h
+++ b/liblwgeom/liblwgeom_internal.h
@@ -72,6 +72,21 @@
#define STR_IEQUALS(A, B) (strcasecmp((A), (B)) == 0)
#define STR_ISTARTS(A, B) (strncasecmp((A), (B), strlen((B))) == 0)
+#ifndef FALLTHROUGH
+ #if defined(__cplusplus) && __cplusplus >= 201703L
+ #define FALLTHROUGH [[fallthrough]]
+ #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+ #define FALLTHROUGH [[fallthrough]]
+ #elif defined(__clang__)
+ #define FALLTHROUGH __attribute__((fallthrough))
+ #elif defined(__GNUC__) && __GNUC__ >= 7
+ #define FALLTHROUGH __attribute__((fallthrough))
+ #elif defined(_MSC_VER) && _MSC_VER >= 1910
+ #define FALLTHROUGH [[fallthrough]]
+ #else
+ #define FALLTHROUGH ((void)0)
+ #endif
+#endif
/*
* this will change to NaN when I figure out how to
diff --git a/liblwgeom/lwboundingcircle.c b/liblwgeom/lwboundingcircle.c
index ba6bc40d7..673b40a1f 100644
--- a/liblwgeom/lwboundingcircle.c
+++ b/liblwgeom/lwboundingcircle.c
@@ -33,7 +33,7 @@ typedef struct {
} SUPPORTING_POINTS;
static SUPPORTING_POINTS*
-supporting_points_create()
+supporting_points_create(void)
{
SUPPORTING_POINTS* s = lwalloc(sizeof(SUPPORTING_POINTS));
s->p1 = NULL;
@@ -214,7 +214,7 @@ calculate_mbc(const POINT2D** points, uint32_t max_n, SUPPORTING_POINTS* support
}
static LWBOUNDINGCIRCLE*
-lwboundingcircle_create()
+lwboundingcircle_create(void)
{
LWBOUNDINGCIRCLE* c = lwalloc(sizeof(LWBOUNDINGCIRCLE));
c->center = lwalloc(sizeof(POINT2D));
diff --git a/liblwgeom/lwgeom_api.c b/liblwgeom/lwgeom_api.c
index 8d5a0f0e1..99e51b0ca 100644
--- a/liblwgeom/lwgeom_api.c
+++ b/liblwgeom/lwgeom_api.c
@@ -35,7 +35,7 @@
#define str(s) #s
const char *
-lwgeom_version()
+lwgeom_version(void)
{
static char *ptr = NULL;
static char buf[256];
@@ -655,11 +655,11 @@ interpolate_point4d(const POINT4D *A, const POINT4D *B, POINT4D *I, double F)
int _lwgeom_interrupt_requested = 0;
void
-lwgeom_request_interrupt() {
+lwgeom_request_interrupt(void) {
_lwgeom_interrupt_requested = 1;
}
void
-lwgeom_cancel_interrupt() {
+lwgeom_cancel_interrupt(void) {
_lwgeom_interrupt_requested = 0;
}
diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c
index 1fe21fa16..d53bd071d 100644
--- a/libpgcommon/lwgeom_transform.c
+++ b/libpgcommon/lwgeom_transform.c
@@ -96,7 +96,7 @@ PROJSRSDestroyPortalCache(void *portalCache)
* If it doesn't exist, make a new blank one and return it.
*/
PROJSRSCache *
-GetPROJSRSCache()
+GetPROJSRSCache(void)
{
PROJSRSCache* cache = PROJ_CACHE;
if (!cache)
diff --git a/libpgcommon/lwgeom_transform.h b/libpgcommon/lwgeom_transform.h
index be0ae1978..c42d21530 100644
--- a/libpgcommon/lwgeom_transform.h
+++ b/libpgcommon/lwgeom_transform.h
@@ -57,7 +57,7 @@ typedef struct srs_precision
} srs_precision;
/* Prototypes */
-PROJSRSCache* GetPROJSRSCache();
+PROJSRSCache* GetPROJSRSCache(void);
int lwproj_lookup(int32_t srid_from, int32_t srid_to, LWPROJ **pj);
int lwproj_is_latlong(const LWPROJ *pj);
int spheroid_init_from_srid(int32_t srid, SPHEROID *s);
diff --git a/loader/cunit/cu_tester.c b/loader/cunit/cu_tester.c
index d47d5b1aa..37fd810ec 100644
--- a/loader/cunit/cu_tester.c
+++ b/loader/cunit/cu_tester.c
@@ -20,7 +20,7 @@
** Returns a CUE_SUCCESS on successful running, another
** CUnit error code on failure.
*/
-int main()
+int main(void)
{
/* initialize the CUnit test registry */
diff --git a/postgis/gserialized_typmod.c b/postgis/gserialized_typmod.c
index 2c9f64b56..daeaf1ad3 100644
--- a/postgis/gserialized_typmod.c
+++ b/postgis/gserialized_typmod.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
+#include <limits.h>
#include "utils/elog.h"
#include "utils/array.h"
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 1e126ce82..e4900c943 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2717,8 +2717,10 @@ Datum LWGEOM_angle(PG_FUNCTION_ARGS)
{
default: /*always executed*/
for (j = 0; j <= i; j++)
+ {
PG_FREE_IF_COPY(seri_geoms[j], j);
- /*FALLTHROUGH*/
+ }
+ FALLTHROUGH;
case 1:
lwpgerror("Empty geometry");
PG_RETURN_NULL();
diff --git a/postgis/lwgeom_geos_prepared.c b/postgis/lwgeom_geos_prepared.c
index 2f971a64c..79dafad7e 100644
--- a/postgis/lwgeom_geos_prepared.c
+++ b/postgis/lwgeom_geos_prepared.c
@@ -336,7 +336,7 @@ PrepGeomCacheCleaner(GeomCache *cache)
}
static GeomCache*
-PrepGeomCacheAllocator()
+PrepGeomCacheAllocator(void)
{
PrepGeomCache* prepcache = palloc(sizeof(PrepGeomCache));
memset(prepcache, 0, sizeof(PrepGeomCache));
diff --git a/postgis/lwgeom_transform.c b/postgis/lwgeom_transform.c
index 58bbac8d6..077a2b55e 100644
--- a/postgis/lwgeom_transform.c
+++ b/postgis/lwgeom_transform.c
@@ -409,7 +409,7 @@ srs_tuple_from_entry(const struct srs_entry* entry, TupleDesc tuple_desc)
}
static struct srs_data *
-srs_state_init()
+srs_state_init(void)
{
struct srs_data *state = palloc0(sizeof(*state));
state->capacity = 8192;
diff --git a/postgis/postgis_module.c b/postgis/postgis_module.c
index 8f7bb312e..ae8a6a907 100644
--- a/postgis/postgis_module.c
+++ b/postgis/postgis_module.c
@@ -46,7 +46,7 @@
PG_MODULE_MAGIC;
-static void interrupt_geos_callback()
+static void interrupt_geos_callback(void)
{
#ifdef WIN32
if (UNBLOCKED_SIGNAL_QUEUE())
@@ -65,7 +65,7 @@ static void interrupt_geos_callback()
}
}
-static void interrupt_liblwgeom_callback()
+static void interrupt_liblwgeom_callback(void)
{
#ifdef WIN32
if (UNBLOCKED_SIGNAL_QUEUE())
diff --git a/raster/rt_pg/rtpg_mapalgebra.c b/raster/rt_pg/rtpg_mapalgebra.c
index 6e4b9da38..128394139 100644
--- a/raster/rt_pg/rtpg_mapalgebra.c
+++ b/raster/rt_pg/rtpg_mapalgebra.c
@@ -6543,8 +6543,7 @@ Datum RASTER_mapAlgebra2(PG_FUNCTION_ARGS)
switch (extenttype) {
case ET_FIRST:
i = 0;
- /* fall through */
- __attribute__((fallthrough));
+ FALLTHROUGH;
case ET_SECOND:
if (i > 1)
i = 1;
diff --git a/raster/rt_pg/rtpg_pixel.c b/raster/rt_pg/rtpg_pixel.c
index 2bfecf4d4..9aa65ebea 100644
--- a/raster/rt_pg/rtpg_pixel.c
+++ b/raster/rt_pg/rtpg_pixel.c
@@ -349,7 +349,7 @@ struct rtpg_dumpvalues_arg_t {
bool **nodata;
};
-static rtpg_dumpvalues_arg rtpg_dumpvalues_arg_init() {
+static rtpg_dumpvalues_arg rtpg_dumpvalues_arg_init(void) {
rtpg_dumpvalues_arg arg = NULL;
arg = palloc(sizeof(struct rtpg_dumpvalues_arg_t));
@@ -1292,7 +1292,7 @@ struct rtpg_setvaluesgv_geomval_t {
rt_raster mask;
};
-static rtpg_setvaluesgv_arg rtpg_setvaluesgv_arg_init() {
+static rtpg_setvaluesgv_arg rtpg_setvaluesgv_arg_init(void) {
rtpg_setvaluesgv_arg arg = palloc(sizeof(struct rtpg_setvaluesgv_arg_t));
if (arg == NULL) {
elog(ERROR, "rtpg_setvaluesgv_arg_init: Could not allocate memory for function arguments");
diff --git a/raster/rt_pg/rtpg_statistics.c b/raster/rt_pg/rtpg_statistics.c
index bffdf0e6b..03219f74e 100644
--- a/raster/rt_pg/rtpg_statistics.c
+++ b/raster/rt_pg/rtpg_statistics.c
@@ -513,7 +513,7 @@ rtpg_summarystats_arg_destroy(rtpg_summarystats_arg arg) {
}
static rtpg_summarystats_arg
-rtpg_summarystats_arg_init() {
+rtpg_summarystats_arg_init(void) {
rtpg_summarystats_arg arg = NULL;
arg = palloc(sizeof(struct rtpg_summarystats_arg_t));
diff --git a/raster/test/cunit/cu_band_basics.c b/raster/test/cunit/cu_band_basics.c
index 5219442e9..6a67f5d28 100644
--- a/raster/test/cunit/cu_band_basics.c
+++ b/raster/test/cunit/cu_band_basics.c
@@ -25,7 +25,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_band_metadata() {
+static void test_band_metadata(void) {
rt_raster rast = NULL;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -147,7 +147,7 @@ static void test_band_metadata() {
cu_free_raster(rast);
}
-static void test_band_pixtype_1BB() {
+static void test_band_pixtype_1BB(void) {
rt_pixtype pixtype = PT_1BB;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -221,7 +221,7 @@ static void test_band_pixtype_1BB() {
rt_band_destroy(band);
}
-static void test_band_pixtype_2BUI() {
+static void test_band_pixtype_2BUI(void) {
rt_pixtype pixtype = PT_2BUI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -313,7 +313,7 @@ static void test_band_pixtype_2BUI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_4BUI() {
+static void test_band_pixtype_4BUI(void) {
rt_pixtype pixtype = PT_4BUI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -419,7 +419,7 @@ static void test_band_pixtype_4BUI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_8BUI() {
+static void test_band_pixtype_8BUI(void) {
rt_pixtype pixtype = PT_8BUI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -527,7 +527,7 @@ static void test_band_pixtype_8BUI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_8BSI() {
+static void test_band_pixtype_8BSI(void) {
rt_pixtype pixtype = PT_8BSI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -659,7 +659,7 @@ static void test_band_pixtype_8BSI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_16BUI() {
+static void test_band_pixtype_16BUI(void) {
rt_pixtype pixtype = PT_16BUI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -748,7 +748,7 @@ static void test_band_pixtype_16BUI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_16BSI() {
+static void test_band_pixtype_16BSI(void) {
rt_pixtype pixtype = PT_16BSI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -860,7 +860,7 @@ static void test_band_pixtype_16BSI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_32BUI() {
+static void test_band_pixtype_32BUI(void) {
rt_pixtype pixtype = PT_32BUI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -956,7 +956,7 @@ static void test_band_pixtype_32BUI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_32BSI() {
+static void test_band_pixtype_32BSI(void) {
rt_pixtype pixtype = PT_32BSI;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -1053,7 +1053,7 @@ static void test_band_pixtype_32BSI() {
rt_band_destroy(band);
}
-static void test_band_pixtype_32BF() {
+static void test_band_pixtype_32BF(void) {
rt_pixtype pixtype = PT_32BF;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -1135,7 +1135,7 @@ static void test_band_pixtype_32BF() {
rt_band_destroy(band);
}
-static void test_band_pixtype_64BF() {
+static void test_band_pixtype_64BF(void) {
rt_pixtype pixtype = PT_64BF;
uint8_t *data = NULL;
rt_band band = NULL;
@@ -1217,7 +1217,7 @@ static void test_band_pixtype_64BF() {
rt_band_destroy(band);
}
-static void test_band_get_pixel_line() {
+static void test_band_get_pixel_line(void) {
rt_raster rast;
rt_band band;
int maxX = 5;
@@ -1259,7 +1259,7 @@ static void test_band_get_pixel_line() {
cu_free_raster(rast);
}
-static void test_band_new_offline_from_path() {
+static void test_band_new_offline_from_path(void) {
rt_band band = NULL;
int width = 10;
int height = 10;
diff --git a/raster/test/cunit/cu_band_misc.c b/raster/test/cunit/cu_band_misc.c
index 0e1686564..f3af3f0a4 100644
--- a/raster/test/cunit/cu_band_misc.c
+++ b/raster/test/cunit/cu_band_misc.c
@@ -25,7 +25,7 @@
#include "cu_tester.h"
#include <math.h>
-static void test_band_get_nearest_pixel() {
+static void test_band_get_nearest_pixel(void) {
rt_raster rast;
rt_band band;
int x, y;
@@ -287,7 +287,7 @@ static void test_band_get_nearest_pixel() {
cu_free_raster(rast);
}
-static void test_band_get_pixel_of_value() {
+static void test_band_get_pixel_of_value(void) {
rt_raster rast;
rt_band band;
uint32_t x, y;
@@ -367,7 +367,7 @@ static void test_band_get_pixel_of_value() {
cu_free_raster(rast);
}
-static void test_pixel_set_to_array(){
+static void test_pixel_set_to_array(void){
rt_raster rast;
rt_band band;
rt_mask mask = NULL;
diff --git a/raster/test/cunit/cu_gdal.c b/raster/test/cunit/cu_gdal.c
index 421bf93f3..3358e0b48 100644
--- a/raster/test/cunit/cu_gdal.c
+++ b/raster/test/cunit/cu_gdal.c
@@ -24,11 +24,11 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_gdal_configured() {
+static void test_gdal_configured(void) {
CU_ASSERT(rt_util_gdal_configured());
}
-static void test_gdal_drivers() {
+static void test_gdal_drivers(void) {
uint32_t i;
uint32_t size;
rt_gdaldriver drv = NULL;
@@ -46,7 +46,7 @@ static void test_gdal_drivers() {
rtdealloc(drv);
}
-static void test_gdal_rasterize() {
+static void test_gdal_rasterize(void) {
rt_raster raster;
char srs[] = "PROJCS[\"unnamed\",GEOGCS[\"unnamed ellipse\",DATUM[\"unknown\",SPHEROID[\"unnamed\",6370997,0]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",45],PARAMETER[\"longitude_of_center\",-100],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1],AUTHORITY[\"EPSG\",\"2163\"]]";
const char wkb_hex[] = "010300000001000000050000000000000080841ec100000000600122410000000080841ec100000000804f22410000000040e81dc100000000804f22410000000040e81dc100000000600122410000000080841ec10000000060012241";
@@ -151,7 +151,7 @@ static rt_raster fillRasterToPolygonize(int hasnodata, double nodataval) {
return raster;
}
-static void test_gdal_polygonize() {
+static void test_gdal_polygonize(void) {
int i;
rt_raster rt;
int nPols = 0;
@@ -277,7 +277,7 @@ static void test_gdal_polygonize() {
cu_free_raster(rt);
}
-static void test_raster_to_gdal() {
+static void test_raster_to_gdal(void) {
rt_pixtype pixtype = PT_64BF;
rt_raster raster = NULL;
rt_band band = NULL;
@@ -350,7 +350,7 @@ static void test_raster_to_gdal() {
cu_free_raster(raster);
}
-static void test_gdal_to_raster() {
+static void test_gdal_to_raster(void) {
rt_pixtype pixtype = PT_64BF;
rt_band band = NULL;
@@ -473,7 +473,7 @@ static void test_gdal_to_raster() {
cu_free_raster(raster);
}
-static void test_gdal_warp() {
+static void test_gdal_warp(void) {
rt_pixtype pixtype = PT_64BF;
rt_band band = NULL;
diff --git a/raster/test/cunit/cu_mapalgebra.c b/raster/test/cunit/cu_mapalgebra.c
index 32e9e6e04..553cc7c36 100644
--- a/raster/test/cunit/cu_mapalgebra.c
+++ b/raster/test/cunit/cu_mapalgebra.c
@@ -492,7 +492,7 @@ static int testRasterIterator7_callback(rt_iterator_arg arg, void *userarg, doub
return 1;
}
-static void test_raster_iterator() {
+static void test_raster_iterator(void) {
rt_raster rast1;
rt_raster rast2;
rt_raster rast3;
@@ -793,7 +793,7 @@ static void test_raster_iterator() {
if (rtn != NULL) cu_free_raster(rtn);
}
-static void test_band_reclass() {
+static void test_band_reclass(void) {
rt_reclassexpr *exprset;
rt_raster raster;
@@ -879,7 +879,7 @@ static void test_band_reclass() {
rt_band_destroy(newband);
}
-static void test_raster_colormap() {
+static void test_raster_colormap(void) {
rt_raster raster;
rt_raster rtn;
rt_band band;
diff --git a/raster/test/cunit/cu_misc.c b/raster/test/cunit/cu_misc.c
index 24c618dbd..791d70136 100644
--- a/raster/test/cunit/cu_misc.c
+++ b/raster/test/cunit/cu_misc.c
@@ -24,7 +24,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_rgb_to_hsv() {
+static void test_rgb_to_hsv(void) {
double rgb[3] = {0, 0, 0};
double hsv[3] = {0, 0, 0};
@@ -66,7 +66,7 @@ static void test_rgb_to_hsv() {
CU_ASSERT_DOUBLE_EQUAL(hsv[2], 0.4, DBL_EPSILON);
}
-static void test_hsv_to_rgb() {
+static void test_hsv_to_rgb(void) {
double hsv[3] = {0, 0, 0};
double rgb[3] = {0, 0, 0};
@@ -108,7 +108,7 @@ static void test_hsv_to_rgb() {
CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0.4, DBL_EPSILON);
}
-static void test_util_gdal_open() {
+static void test_util_gdal_open(void) {
extern char *gdal_enabled_drivers;
GDALDatasetH ds;
diff --git a/raster/test/cunit/cu_pixtype.c b/raster/test/cunit/cu_pixtype.c
index 45333a35e..5ac1afef3 100644
--- a/raster/test/cunit/cu_pixtype.c
+++ b/raster/test/cunit/cu_pixtype.c
@@ -24,7 +24,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_pixtype_size() {
+static void test_pixtype_size(void) {
CU_ASSERT_EQUAL(rt_pixtype_size(PT_1BB), 1);
CU_ASSERT_EQUAL(rt_pixtype_size(PT_2BUI), 1);
CU_ASSERT_EQUAL(rt_pixtype_size(PT_4BUI), 1);
@@ -40,11 +40,11 @@ static void test_pixtype_size() {
CU_ASSERT_EQUAL(rt_pixtype_size(PT_END), -1);
}
-static void test_pixtype_alignment() {
+static void test_pixtype_alignment(void) {
/* rt_pixtype_alignment() just forwards to rt_pixtype_size() */
}
-static void test_pixtype_name() {
+static void test_pixtype_name(void) {
CU_ASSERT_STRING_EQUAL(rt_pixtype_name(PT_1BB), "1BB");
CU_ASSERT_STRING_EQUAL(rt_pixtype_name(PT_2BUI), "2BUI");
CU_ASSERT_STRING_EQUAL(rt_pixtype_name(PT_4BUI), "4BUI");
@@ -60,7 +60,7 @@ static void test_pixtype_name() {
CU_ASSERT_STRING_EQUAL(rt_pixtype_name(PT_END), "Unknown");
}
-static void test_pixtype_index_from_name() {
+static void test_pixtype_index_from_name(void) {
CU_ASSERT_EQUAL(rt_pixtype_index_from_name("1BB"), PT_1BB);
CU_ASSERT_EQUAL(rt_pixtype_index_from_name("2BUI"), PT_2BUI);
CU_ASSERT_EQUAL(rt_pixtype_index_from_name("4BUI"), PT_4BUI);
@@ -79,7 +79,7 @@ static void test_pixtype_index_from_name() {
CU_ASSERT_EQUAL(rt_pixtype_index_from_name("3BUI"), PT_END);
}
-static void test_pixtype_get_min_value() {
+static void test_pixtype_get_min_value(void) {
CU_ASSERT_DOUBLE_EQUAL(rt_pixtype_get_min_value(PT_1BB), rt_util_clamp_to_1BB((double) CHAR_MIN), DBL_EPSILON);
CU_ASSERT_DOUBLE_EQUAL(rt_pixtype_get_min_value(PT_2BUI), rt_util_clamp_to_2BUI((double) CHAR_MIN), DBL_EPSILON);
CU_ASSERT_DOUBLE_EQUAL(rt_pixtype_get_min_value(PT_4BUI), rt_util_clamp_to_4BUI((double) CHAR_MIN), DBL_EPSILON);
@@ -95,7 +95,7 @@ static void test_pixtype_get_min_value() {
CU_ASSERT_DOUBLE_EQUAL(rt_pixtype_get_min_value(PT_END), rt_util_clamp_to_8BUI((double) CHAR_MIN), DBL_EPSILON);
}
-static void test_pixtype_compare_clamped_values() {
+static void test_pixtype_compare_clamped_values(void) {
int isequal = 0;
/* 1BB */
diff --git a/raster/test/cunit/cu_raster_basics.c b/raster/test/cunit/cu_raster_basics.c
index 98d640a1a..ad68cba9d 100644
--- a/raster/test/cunit/cu_raster_basics.c
+++ b/raster/test/cunit/cu_raster_basics.c
@@ -24,7 +24,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_raster_new() {
+static void test_raster_new(void) {
rt_raster raster = NULL;
raster = rt_raster_new(0, 0);
@@ -40,7 +40,7 @@ static void test_raster_new() {
cu_free_raster(raster);
}
-static void test_raster_empty() {
+static void test_raster_empty(void) {
rt_raster raster = NULL;
/* check that raster is empty */
@@ -59,7 +59,7 @@ static void test_raster_empty() {
cu_free_raster(raster);
}
-static void test_raster_metadata() {
+static void test_raster_metadata(void) {
rt_raster raster = NULL;
/* create raster */
@@ -96,7 +96,7 @@ static void test_raster_metadata() {
cu_free_raster(raster);
}
-static void test_raster_clone() {
+static void test_raster_clone(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band;
@@ -140,7 +140,7 @@ static void test_raster_clone() {
cu_free_raster(rast1);
}
-static void test_raster_from_band() {
+static void test_raster_from_band(void) {
uint32_t bandNums[] = {1,3};
int lenBandNums = 2;
rt_raster raster;
@@ -169,7 +169,7 @@ static void test_raster_from_band() {
cu_free_raster(raster);
}
-static void test_raster_replace_band() {
+static void test_raster_replace_band(void) {
rt_raster raster;
rt_band band;
rt_band rband;
diff --git a/raster/test/cunit/cu_raster_geometry.c b/raster/test/cunit/cu_raster_geometry.c
index 162e44789..97ebb40f4 100644
--- a/raster/test/cunit/cu_raster_geometry.c
+++ b/raster/test/cunit/cu_raster_geometry.c
@@ -24,7 +24,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_raster_envelope() {
+static void test_raster_envelope(void) {
rt_raster raster = NULL;
rt_envelope rtenv;
@@ -85,7 +85,7 @@ static void test_raster_envelope() {
cu_free_raster(raster);
}
-static void test_raster_envelope_geom() {
+static void test_raster_envelope_geom(void) {
rt_raster raster = NULL;
LWGEOM *env = NULL;
LWPOLY *poly = NULL;
@@ -163,7 +163,7 @@ static void test_raster_envelope_geom() {
cu_free_raster(raster);
}
-static void test_raster_convex_hull() {
+static void test_raster_convex_hull(void) {
rt_raster raster = NULL;
LWGEOM *hull = NULL;
LWPOLY *poly = NULL;
@@ -252,7 +252,7 @@ lwgeom_to_text(const LWGEOM *lwgeom) {
return wkt;
}
-static void test_raster_surface() {
+static void test_raster_surface(void) {
rt_raster rast;
rt_band band;
const int maxX = 5;
@@ -374,7 +374,7 @@ static void test_raster_surface() {
cu_free_raster(rast);
}
-static void test_raster_perimeter() {
+static void test_raster_perimeter(void) {
rt_raster rast;
rt_band band;
const int maxX = 5;
@@ -528,7 +528,7 @@ static void test_raster_perimeter() {
cu_free_raster(rast);
}
-static void test_raster_pixel_as_polygon() {
+static void test_raster_pixel_as_polygon(void) {
rt_raster rast;
rt_band band;
uint32_t x, y;
@@ -576,7 +576,7 @@ static void test_raster_pixel_as_polygon() {
-static void test_raster_get_pixel_bilinear() {
+static void test_raster_get_pixel_bilinear(void) {
uint32_t width = 2;
uint32_t height = 2;
double ul_x = 0.0;
diff --git a/raster/test/cunit/cu_raster_misc.c b/raster/test/cunit/cu_raster_misc.c
index b2ed95e17..90888a9aa 100644
--- a/raster/test/cunit/cu_raster_misc.c
+++ b/raster/test/cunit/cu_raster_misc.c
@@ -24,7 +24,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_raster_cell_to_geopoint() {
+static void test_raster_cell_to_geopoint(void) {
rt_raster raster;
int rtn;
double xw, yw;
@@ -43,7 +43,7 @@ static void test_raster_cell_to_geopoint() {
cu_free_raster(raster);
}
-static void test_raster_geopoint_to_cell() {
+static void test_raster_geopoint_to_cell(void) {
rt_raster raster;
int rtn;
double xr, yr;
@@ -62,7 +62,7 @@ static void test_raster_geopoint_to_cell() {
cu_free_raster(raster);
}
-static void test_raster_from_two_rasters() {
+static void test_raster_from_two_rasters(void) {
rt_raster rast1;
rt_raster rast2;
rt_raster rast = NULL;
@@ -175,7 +175,7 @@ static void test_raster_from_two_rasters() {
cu_free_raster(rast1);
}
-static void test_raster_compute_skewed_raster() {
+static void test_raster_compute_skewed_raster(void) {
rt_envelope extent;
rt_raster rast;
double skew[2] = {0.25, 0.25};
diff --git a/raster/test/cunit/cu_raster_wkb.c b/raster/test/cunit/cu_raster_wkb.c
index fd36aa6f9..e1e6219e1 100644
--- a/raster/test/cunit/cu_raster_wkb.c
+++ b/raster/test/cunit/cu_raster_wkb.c
@@ -25,7 +25,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_raster_wkb() {
+static void test_raster_wkb(void) {
/* will use default allocators and message handlers */
rt_raster raster = NULL;
const char *hexwkb = NULL;
diff --git a/raster/test/cunit/cu_spatial_relationship.c b/raster/test/cunit/cu_spatial_relationship.c
index f99e78b01..7438367e4 100644
--- a/raster/test/cunit/cu_spatial_relationship.c
+++ b/raster/test/cunit/cu_spatial_relationship.c
@@ -24,7 +24,7 @@
#include "CUnit/Basic.h"
#include "cu_tester.h"
-static void test_raster_geos_overlaps() {
+static void test_raster_geos_overlaps(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -499,7 +499,7 @@ static void test_raster_geos_overlaps() {
cu_free_raster(rast1);
}
-static void test_raster_geos_touches() {
+static void test_raster_geos_touches(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -1026,7 +1026,7 @@ static void test_raster_geos_touches() {
cu_free_raster(rast1);
}
-static void test_raster_geos_contains() {
+static void test_raster_geos_contains(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -1553,7 +1553,7 @@ static void test_raster_geos_contains() {
cu_free_raster(rast1);
}
-static void test_raster_geos_contains_properly() {
+static void test_raster_geos_contains_properly(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -2080,7 +2080,7 @@ static void test_raster_geos_contains_properly() {
cu_free_raster(rast1);
}
-static void test_raster_geos_covers() {
+static void test_raster_geos_covers(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -2607,7 +2607,7 @@ static void test_raster_geos_covers() {
cu_free_raster(rast1);
}
-static void test_raster_geos_covered_by() {
+static void test_raster_geos_covered_by(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -3134,7 +3134,7 @@ static void test_raster_geos_covered_by() {
cu_free_raster(rast1);
}
-static void test_raster_within_distance() {
+static void test_raster_within_distance(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -3696,7 +3696,7 @@ static void test_raster_within_distance() {
cu_free_raster(rast1);
}
-static void test_raster_fully_within_distance() {
+static void test_raster_fully_within_distance(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -4258,7 +4258,7 @@ static void test_raster_fully_within_distance() {
cu_free_raster(rast1);
}
-static void test_raster_intersects() {
+static void test_raster_intersects(void) {
rt_raster rast1;
rt_raster rast2;
rt_band band1;
@@ -4725,7 +4725,7 @@ static void test_raster_intersects() {
cu_free_raster(rast1);
}
-static void test_raster_same_alignment() {
+static void test_raster_same_alignment(void) {
rt_raster rast1;
rt_raster rast2;
int rtn;
commit 44ac9bc46984fd649ebdc9076aecd0e678136314
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 16:33:36 2026 -0700
Remove potential null dereference in ptarray_calc_areas()
diff --git a/liblwgeom/effectivearea.c b/liblwgeom/effectivearea.c
index 6efeb0eb5..a16dfce1c 100644
--- a/liblwgeom/effectivearea.c
+++ b/liblwgeom/effectivearea.c
@@ -358,6 +358,9 @@ void ptarray_calc_areas(EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, do
const double *P2;
const double *P3;
+ if (npoints < 2)
+ lwerror("%s: not enough points provided", __func__);
+
P1 = (double*)getPoint_internal(ea->inpts, 0);
P2 = (double*)getPoint_internal(ea->inpts, 1);
commit 16d388906c641f702d5e5c669f311e59103ed216
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 16:33:16 2026 -0700
Remove potential null dereference in lwcircstring_linearize()
diff --git a/liblwgeom/lwstroke.c b/liblwgeom/lwstroke.c
index 3adfeb055..5bea73a24 100644
--- a/liblwgeom/lwstroke.c
+++ b/liblwgeom/lwstroke.c
@@ -565,8 +565,11 @@ lwcircstring_linearize(const LWCIRCSTRING *icurve, double tol,
return NULL;
}
}
- getPoint4d_p(icurve->points, icurve->points->npoints-1, &p1);
- ptarray_append_point(ptarray, &p1, LW_FALSE);
+ if (icurve->points->npoints > 0)
+ {
+ getPoint4d_p(icurve->points, icurve->points->npoints-1, &p1);
+ ptarray_append_point(ptarray, &p1, LW_FALSE);
+ }
oline = lwline_construct(icurve->srid, NULL, ptarray);
return oline;
commit 7372f89acd938ff9c6f46d2822b34b4089d5d07c
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 15:55:18 2026 -0700
Remove potential null dereference in pt_in_ring_3d()
diff --git a/liblwgeom/measures3d.c b/liblwgeom/measures3d.c
index 57b29ffe2..bc3e6d063 100644
--- a/liblwgeom/measures3d.c
+++ b/liblwgeom/measures3d.c
@@ -1579,6 +1579,9 @@ pt_in_ring_3d(const POINT3DZ *p, const POINTARRAY *ring, PLANE3D *plane)
POINT3DZ first, last;
+ if ( !ring || ring->npoints == 0 )
+ lwerror("%s called on empty pointarray", __func__);
+
getPoint3dz_p(ring, 0, &first);
getPoint3dz_p(ring, ring->npoints - 1, &last);
if (memcmp(&first, &last, sizeof(POINT3DZ)))
commit af79a7a0cb8d5e9219f4c3bfcca64fbc0b927eb0
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 15:36:05 2026 -0700
Remove potential null dereference from ptarray_contains_point_partial()
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 2afb12c44..de8944089 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -1042,10 +1042,13 @@ ptarray_contains_point_partial(const POINTARRAY *pa, const POINT2D *pt, int chec
const POINT2D *seg1, *seg2;
double ymin, ymax;
+ if ( !pa || !pa->npoints )
+ lwerror("%s called on empty pointarray", __func__);
+
seg1 = getPoint2d_cp(pa, 0);
seg2 = getPoint2d_cp(pa, pa->npoints-1);
if ( check_closed && ! p2d_same(seg1, seg2) )
- lwerror("ptarray_contains_point called on unclosed ring");
+ lwerror("%s called on unclosed ring", __func__);
for ( i=1; i < pa->npoints; i++ )
{
commit 72c3a7a5e7006c228e796324087be3c117793ea1
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 15:31:16 2026 -0700
Remove unused function pt_in_ring_2d()
diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in
index 54eb1e7ed..391c383aa 100644
--- a/liblwgeom/liblwgeom.h.in
+++ b/liblwgeom/liblwgeom.h.in
@@ -1365,7 +1365,6 @@ extern uint32_t lwcompound_num_curves(const LWCOMPOUND *compound);
extern const LWGEOM *lwcollection_getsubcurve(const LWCOMPOUND *compound, uint32_t gnum);
extern double ptarray_length_2d(const POINTARRAY *pts);
-extern int pt_in_ring_2d(const POINT2D *p, const POINTARRAY *ring);
extern int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret);
extern LWPOINT* lwpoint_project_lwpoint(const LWPOINT* lwpoint1, const LWPOINT* lwpoint2, double distance);
extern LWPOINT* lwpoint_project(const LWPOINT* lwpoint1, double distance, double azimuth);
diff --git a/liblwgeom/liblwgeom_internal.h b/liblwgeom/liblwgeom_internal.h
index 04a3504e2..610807120 100644
--- a/liblwgeom/liblwgeom_internal.h
+++ b/liblwgeom/liblwgeom_internal.h
@@ -448,7 +448,6 @@ int lw_arc_is_pt(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3);
int lw_pt_on_segment(const POINT2D* p1, const POINT2D* p2, const POINT2D* p);
double lw_seg_length(const POINT2D *A1, const POINT2D *A2);
double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3);
-int pt_in_ring_2d(const POINT2D *p, const POINTARRAY *ring);
int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt);
int ptarrayarc_contains_point(const POINTARRAY *pa, const POINT2D *pt);
int ptarray_contains_point_partial(const POINTARRAY *pa, const POINT2D *pt, int check_closed, int *winding_number);
diff --git a/liblwgeom/lwalgorithm.c b/liblwgeom/lwalgorithm.c
index 9f9e42503..92a16d335 100644
--- a/liblwgeom/lwalgorithm.c
+++ b/liblwgeom/lwalgorithm.c
@@ -293,62 +293,6 @@ lw_arc_center(const POINT2D *p1, const POINT2D *p2, const POINT2D *p3, POINT2D *
return cr;
}
-int
-pt_in_ring_2d(const POINT2D *p, const POINTARRAY *ring)
-{
- int cn = 0; /* the crossing number counter */
- uint32_t i;
- const POINT2D *v1, *v2;
- const POINT2D *first, *last;
-
- first = getPoint2d_cp(ring, 0);
- last = getPoint2d_cp(ring, ring->npoints-1);
- if ( memcmp(first, last, sizeof(POINT2D)) )
- {
- lwerror("pt_in_ring_2d: V[n] != V[0] (%g %g != %g %g)",
- first->x, first->y, last->x, last->y);
- return LW_FALSE;
-
- }
-
- LWDEBUGF(2, "pt_in_ring_2d called with point: %g %g", p->x, p->y);
- /* printPA(ring); */
-
- /* loop through all edges of the polygon */
- v1 = getPoint2d_cp(ring, 0);
- for (i=0; i<ring->npoints-1; i++)
- {
- double vt;
- v2 = getPoint2d_cp(ring, i+1);
-
- /* edge from vertex i to vertex i+1 */
- if
- (
- /* an upward crossing */
- ((v1->y <= p->y) && (v2->y > p->y))
- /* a downward crossing */
- || ((v1->y > p->y) && (v2->y <= p->y))
- )
- {
-
- vt = (double)(p->y - v1->y) / (v2->y - v1->y);
-
- /* P->x <intersect */
- if (p->x < v1->x + vt * (v2->x - v1->x))
- {
- /* a valid crossing of y=p->y right of p->x */
- ++cn;
- }
- }
- v1 = v2;
- }
-
- LWDEBUGF(3, "pt_in_ring_2d returning %d", cn&1);
-
- return (cn&1); /* 0 if even (out), and 1 if odd (in) */
-}
-
-
static int
lw_seg_interact(const POINT2D *p1, const POINT2D *p2, const POINT2D *q1, const POINT2D *q2)
{
commit 4c85dfa2c69fcdc12cd428f033529301908ca251
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 15:29:19 2026 -0700
Remove reported crash in lwcompound_add_lwgeom()
diff --git a/liblwgeom/lwcompound.c b/liblwgeom/lwcompound.c
index 770acdc6b..f33b0f729 100644
--- a/liblwgeom/lwcompound.c
+++ b/liblwgeom/lwcompound.c
@@ -168,6 +168,9 @@ int lwcompound_add_lwgeom(LWCOMPOUND *comp, LWGEOM *geom)
/* Last point of the previous component */
LWLINE *prevline = (LWLINE*)(col->geoms[col->ngeoms-1]);
+ if (lwline_is_empty(prevline))
+ return LW_FAILURE;
+
getPoint4d_p(newline->points, 0, &first);
getPoint4d_p(prevline->points, prevline->points->npoints-1, &last);
commit 75254c60697241cd8a8804bbc37feb9a0a1890f1
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 14:56:21 2026 -0700
Remove reported crash in lwcompound_is_closed()
diff --git a/liblwgeom/lwcompound.c b/liblwgeom/lwcompound.c
index 1e0d5c2ee..770acdc6b 100644
--- a/liblwgeom/lwcompound.c
+++ b/liblwgeom/lwcompound.c
@@ -47,31 +47,40 @@ lwcollection_getsubcurve(const LWCOMPOUND *compound, uint32_t curvenum)
int
lwcompound_is_closed(const LWCOMPOUND *compound)
{
+ const LWLINE *line_start, *line_end;
+ const POINTARRAY *pa_start, *pa_end;
+
int hasz = lwgeom_has_z(lwcompound_as_lwgeom(compound));
if (lwgeom_is_empty(lwcompound_as_lwgeom(compound)))
return LW_FALSE;
- for (uint32_t i = 0; i < compound->ngeoms; i++)
+ /* Single entry, closes on itself */
+ if (compound->ngeoms == 1 && lwline_is_closed((LWLINE *)(compound->geoms[0])))
+ return LW_TRUE;
+
+ /* If internal connectivity is lacking, so is closure */
+ if (!lwcompound_is_valid(compound))
+ return LW_FALSE;
+
+ /* Internal connection is good, what about start/end points? */
+ line_start = (LWLINE *)(compound->geoms[0]);
+ line_end = (LWLINE *)(compound->geoms[compound->ngeoms-1]);
+ pa_start = line_start->points;
+ pa_end = line_end->points;
+
+ if (hasz)
{
- uint32_t i_end = i == 0 ? compound->ngeoms - 1 : i - 1;
- const LWLINE *geom_start = (LWLINE *)(compound->geoms[i]);
- const LWLINE *geom_end = (LWLINE *)(compound->geoms[i_end]);
- const POINTARRAY *pa_start = geom_start->points;
- const POINTARRAY *pa_end = geom_end->points;
- if (hasz)
- {
- const POINT3D *pt_start = getPoint3d_cp(pa_start, 0);
- const POINT3D *pt_end = getPoint3d_cp(pa_end, pa_end->npoints-1);
- if (!p3d_same(pt_start, pt_end))
- return LW_FALSE;
- }
- else
- {
- const POINT2D *pt_start = getPoint2d_cp(pa_start, 0);
- const POINT2D *pt_end = getPoint2d_cp(pa_end, pa_end->npoints-1);
- if (!p2d_same(pt_start, pt_end))
- return LW_FALSE;
- }
+ const POINT3D *pt_start = getPoint3d_cp(pa_start, 0);
+ const POINT3D *pt_end = getPoint3d_cp(pa_end, pa_end->npoints-1);
+ if (!p3d_same(pt_start, pt_end))
+ return LW_FALSE;
+ }
+ else
+ {
+ const POINT2D *pt_start = getPoint2d_cp(pa_start, 0);
+ const POINT2D *pt_end = getPoint2d_cp(pa_end, pa_end->npoints-1);
+ if (!p2d_same(pt_start, pt_end))
+ return LW_FALSE;
}
return LW_TRUE;
@@ -84,12 +93,24 @@ lwcompound_is_valid(const LWCOMPOUND *compound)
if (lwgeom_is_empty(lwcompound_as_lwgeom(compound)))
return LW_TRUE;
+ /* Only one component, do not need to test connectivity */
+ if (compound->ngeoms == 1)
+ return LW_TRUE;
+
+ /* Check internal connectivity between components */
for (uint32_t i = 1; i < compound->ngeoms; i++)
{
- const LWLINE *geom_start = (LWLINE *)(compound->geoms[i]);
- const LWLINE *geom_end = (LWLINE *)(compound->geoms[i-1]);
- const POINTARRAY *pa_start = geom_start->points;
- const POINTARRAY *pa_end = geom_end->points;
+ const POINTARRAY *pa_start, *pa_end;
+ const LWLINE *line_start = (LWLINE *)(compound->geoms[i]);
+ const LWLINE *line_end = (LWLINE *)(compound->geoms[i-1]);
+
+ /* Empty cannot be a compound component, because it joins nothing */
+ if (lwline_is_empty(line_start) || (lwline_is_empty(line_end)))
+ return LW_FALSE;
+
+ pa_start = line_start->points;
+ pa_end = line_end->points;
+
if (hasz)
{
const POINT3D *pt_start = getPoint3d_cp(pa_start, 0);
commit fa01f2bdc0b17b84000198df12b44ac4ed6dd1da
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Apr 10 13:56:41 2026 -0700
Remove reported crash in lwline_set_effective_area()
diff --git a/liblwgeom/effectivearea.c b/liblwgeom/effectivearea.c
index f0f67c2ea..6efeb0eb5 100644
--- a/liblwgeom/effectivearea.c
+++ b/liblwgeom/effectivearea.c
@@ -464,7 +464,8 @@ static LWLINE* lwline_set_effective_area(const LWLINE *iline,int set_area, doubl
LWLINE *oline = lwline_construct_empty(iline->srid, FLAGS_GET_Z(iline->flags), set_m);
-
+ if (iline->points->npoints < 2)
+ return oline;
oline = lwline_construct(iline->srid, NULL, ptarray_set_effective_area(iline->points,2,set_area,trshld));
@@ -491,7 +492,12 @@ static LWPOLY* lwpoly_set_effective_area(const LWPOLY *ipoly,int set_area, doubl
for (i = 0; i < ipoly->nrings; i++)
{
- POINTARRAY *pa = ptarray_set_effective_area(ipoly->rings[i],avoid_collapse,set_area,trshld);
+ POINTARRAY *pa;
+
+ if (ipoly->rings[i]->npoints < 4)
+ continue;
+
+ pa = ptarray_set_effective_area(ipoly->rings[i],avoid_collapse,set_area,trshld);
/* Add ring to simplified polygon */
if(pa->npoints>=4)
{
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
deps/uthash/include/uthash.h | 39 ++++++++----
deps/wagyu/lwgeom_wagyu.cpp | 6 +-
deps/wagyu/lwgeom_wagyu.h | 6 +-
extensions/address_standardizer/khash.h | 4 +-
extensions/address_standardizer/parseaddress-api.c | 2 +-
extensions/address_standardizer/standard.c | 2 +-
liblwgeom/cunit/cu_ptarray.c | 14 ++---
.../cunit/cu_remove_irrelevant_points_for_view.c | 2 +-
liblwgeom/cunit/cu_tester.c | 12 ++--
liblwgeom/effectivearea.c | 13 +++-
liblwgeom/liblwgeom.h.in | 1 -
liblwgeom/liblwgeom_internal.h | 16 ++++-
liblwgeom/lwalgorithm.c | 56 -----------------
liblwgeom/lwboundingcircle.c | 4 +-
liblwgeom/lwcompound.c | 72 ++++++++++++++--------
liblwgeom/lwgeom_api.c | 6 +-
liblwgeom/lwstroke.c | 7 ++-
liblwgeom/measures3d.c | 3 +
liblwgeom/ptarray.c | 5 +-
libpgcommon/lwgeom_transform.c | 2 +-
libpgcommon/lwgeom_transform.h | 2 +-
loader/cunit/cu_tester.c | 2 +-
postgis/gserialized_typmod.c | 1 +
postgis/lwgeom_functions_basic.c | 4 +-
postgis/lwgeom_geos_prepared.c | 2 +-
postgis/lwgeom_transform.c | 2 +-
postgis/postgis_module.c | 4 +-
raster/rt_pg/rtpg_mapalgebra.c | 3 +-
raster/rt_pg/rtpg_pixel.c | 4 +-
raster/rt_pg/rtpg_statistics.c | 2 +-
raster/test/cunit/cu_band_basics.c | 28 ++++-----
raster/test/cunit/cu_band_misc.c | 6 +-
raster/test/cunit/cu_gdal.c | 14 ++---
raster/test/cunit/cu_mapalgebra.c | 6 +-
raster/test/cunit/cu_misc.c | 6 +-
raster/test/cunit/cu_pixtype.c | 12 ++--
raster/test/cunit/cu_raster_basics.c | 12 ++--
raster/test/cunit/cu_raster_geometry.c | 14 ++---
raster/test/cunit/cu_raster_misc.c | 8 +--
raster/test/cunit/cu_raster_wkb.c | 2 +-
raster/test/cunit/cu_spatial_relationship.c | 20 +++---
42 files changed, 223 insertions(+), 204 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list