Skip to content
Open
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: 1 addition & 1 deletion src/apps/testapps/testBBoxInternal.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ SUITE(BBox) {
"bboxHexEstimate of invalid resolution fails");
}

TEST(bboxHexEstimate_invalidRes) {
TEST(bboxHexEstimate_invalidLatitudeDifference) {
int64_t numHexagons;
BBox bbox = {1.0, 1.0, 0.0, 1.0};
t_assert(bboxHexEstimate(&bbox, 1, &numHexagons) == E_FAILED,
Expand Down
13 changes: 13 additions & 0 deletions src/apps/testapps/testCompactCells.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,19 @@ SUITE(compactCells) {
t_assertSuccess(H3_EXPORT(compactCells)(bad, output, numHex));
}

TEST(compactCells_parentError3) {
const int numHex = 3;
H3Index bad[] = {0x81283ffffffffff, 0, 0};
H3Index output[] = {0, 0, 0};

t_assertSuccess(H3_EXPORT(compactCells)(bad, output, numHex));
t_assert(output[0] == 0x81283ffffffffff,
"output contains expected cell");
for (int i = 1; i < numHex; i++) {
t_assert(output[i] == 0, "output contains nulls");
}
}

TEST(uncompactCells_wrongRes) {
int numHex = 3;
H3Index someHexagons[] = {0, 0, 0};
Expand Down
2 changes: 1 addition & 1 deletion src/h3lib/lib/h3Index.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ H3Error H3_EXPORT(compactCells)(const H3Index *h3Set, H3Index *compactedSet,
// to track how many times a parent is duplicated
for (int64_t i = 0; i < numRemainingHexes; i++) {
H3Index currIndex = remainingHexes[i];
// TODO: This case is coverable (reachable by fuzzer)
// Can occur if 0 is passed in to the input to this function.
if (currIndex != 0) {
// If the reserved bits were set by the caller, the
// algorithm below may encounter undefined behavior
Expand Down
Loading