[geos-commits] [SCM] GEOS branch main updated. cbd9839e30e64d2f851358feaec2ccb2acc1b804
git at osgeo.org
git at osgeo.org
Tue Jun 23 14:14:53 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 "GEOS".
The branch, main has been updated
via cbd9839e30e64d2f851358feaec2ccb2acc1b804 (commit)
from ab8e9c9a6059b407644e041dd739459631856514 (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 cbd9839e30e64d2f851358feaec2ccb2acc1b804
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Jun 23 21:12:01 2026 +0000
Fuzzer fixes
Ensure WKB pointer actually points to start of
WKB segment and not the separator null byte.
Only setup JSON reader once, not for every
iteration.
diff --git a/tests/fuzz/fuzz_geo2.c b/tests/fuzz/fuzz_geo2.c
index ceee7ea6b..26c22e79c 100644
--- a/tests/fuzz/fuzz_geo2.c
+++ b/tests/fuzz/fuzz_geo2.c
@@ -47,7 +47,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
GEOSGeometry *g1 = GEOSGeomFromWKT(Data);
if (g1 != NULL) {
- GEOSGeometry *g2 = GEOSGeomFromWKB_buf(Data+sep, Size-sep);
+ GEOSGeometry *g2 = GEOSGeomFromWKB_buf(Data+sep+1, Size-sep-1);
if (g2 != NULL) {
size_t usize;
GEOSGeometry *g3 = GEOSIntersection(g1, g2);
@@ -57,11 +57,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
g3 = GEOSUnion(g1, g2);
GEOSGeom_destroy(g3);
unsigned char* uptr = GEOSGeomToWKB_buf(g1, &usize);
- free(uptr);
+ GEOSFree(uptr);
GEOSGeom_destroy(g2);
}
char * r = GEOSGeomToWKT(g1);
- free(r);
+ GEOSFree(r);
GEOSGeom_destroy(g1);
}
return 0;
diff --git a/tests/fuzz/fuzz_geojson.c b/tests/fuzz/fuzz_geojson.c
index bbdcc6bfd..28d100ce0 100644
--- a/tests/fuzz/fuzz_geojson.c
+++ b/tests/fuzz/fuzz_geojson.c
@@ -6,8 +6,8 @@
#include "geos_c.h"
-static int initialized = 0;
-FILE * flogOut;
+static FILE * flogOut;
+static GEOSGeoJSONReader *reader;
void
notice(const char *fmt, ...) {
@@ -29,11 +29,17 @@ log_and_exit(const char *fmt, ...) {
fprintf( flogOut, "\n" );
}
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ (void)argc; (void)argv;
+ flogOut = fopen("/dev/null", "wb");
+ initGEOS(notice, log_and_exit);
+ reader = GEOSGeoJSONReader_create();
+ return 0;
+}
+
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (initialized == 0) {
- flogOut = fopen("/dev/null", "wb");
- initGEOS(notice, log_and_exit);
- initialized = 1;
+ if (reader == NULL) {
+ return 0;
}
char *json = (char *) malloc(Size + 1);
@@ -43,13 +49,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
memcpy(json, Data, Size);
json[Size] = '\0';
- GEOSGeoJSONReader *reader = GEOSGeoJSONReader_create();
- if (reader != NULL) {
- GEOSGeometry *g = GEOSGeoJSONReader_readGeometry(reader, json);
- if (g != NULL) {
- GEOSGeom_destroy(g);
- }
- GEOSGeoJSONReader_destroy(reader);
+ GEOSGeometry *g = GEOSGeoJSONReader_readGeometry(reader, json);
+ if (g != NULL) {
+ GEOSGeom_destroy(g);
}
free(json);
-----------------------------------------------------------------------
Summary of changes:
tests/fuzz/fuzz_geo2.c | 6 +++---
tests/fuzz/fuzz_geojson.c | 28 +++++++++++++++-------------
2 files changed, 18 insertions(+), 16 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list