Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The public API of this library consists of the functions declared in file
[h3api.h.in](./src/h3lib/include/h3api.h.in).

## [Unreleased]
### Fixed
- Fixed the `polygonToCells` fuzzer regression test to use explicit double literals instead of reinterpreting raw bytes, so it is portable across endianness (#964)

## [4.5.0] - 2026-05-21
### Added
Expand Down
20 changes: 10 additions & 10 deletions src/apps/testapps/testPolygonToCellsReportedExperimental.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@
SUITE(polygonToCells_reported) {
// fuzzer crash due to inconsistent handling of CONTAINMENT_OVERLAPPING
TEST(fuzzer_crash) {
uint8_t data[] = {
0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0xff,
0xff, 0x0, 0x0, 0x0, 0xa, 0xa, 0xa, 0xa, 0xa, 0xff,
// The vertices below are the exact doubles that the original fuzzer
// input (a raw byte buffer reinterpreted as LatLng) decoded to on a
// little-endian host. Spelling them out as hex-float literals makes
// the test decode identical values on every architecture regardless
// of byte order, instead of reinterpreting raw bytes (see #964).
LatLng verts[] = {
{0x0.000000000ffffp-1022, 0x0p+0},
{0x1.fff00000ap-1008, -0x1.a0a0a0a0ap+1009},
};

uint8_t res = 0;
size_t vertsSize = sizeof(data);
int numVerts = vertsSize / sizeof(LatLng);

GeoPolygon geoPolygon;
geoPolygon.numHoles = 0;
geoPolygon.holes = NULL;
geoPolygon.geoloop.numVerts = numVerts;
// Offset by 1 since *data was used for `res`, above.
geoPolygon.geoloop.verts = (LatLng *)(data);
geoPolygon.geoloop.numVerts = 2;
geoPolygon.geoloop.verts = verts;

uint32_t flags = CONTAINMENT_OVERLAPPING;
int64_t sz;
Expand Down
Loading