Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0277ce5
Add LLVM fuzzer harness
Dec 22, 2021
1c8ec2e
Add AFL++ test case generator
Dec 22, 2021
b89c76b
Fuzz more gridDisk functions
Dec 22, 2021
79d2e2c
add fuzzerH3SetToLinkedGeo
Dec 22, 2021
a28a807
Add more fuzzers
Dec 22, 2021
9445cbb
Additional fuzzers
Dec 22, 2021
f971dcf
add fuzzerVertexes
Dec 22, 2021
e0c8841
Add test-fuzzer script
Dec 22, 2021
007b7c3
Fix linux build
Dec 22, 2021
02abb99
Fix fuzzerIndexIO
Dec 22, 2021
caedc90
test-fuzzer use subshell for ls
isaacbrodsky Dec 22, 2021
de5a2c3
Update test-fuzzer again
isaacbrodsky Dec 22, 2021
8bbc36a
Fix test-fuzzer again
isaacbrodsky Dec 22, 2021
021c994
fuzzerCompact
Dec 23, 2021
2195863
Update readme
Dec 23, 2021
4a65123
libFuzzer tests
Dec 23, 2021
1e7066e
reformat header
Dec 23, 2021
0ede718
README updates
Dec 23, 2021
65b4ef3
fuzzerDirectedEdge
Dec 23, 2021
79b1f44
fuzzerLocalIj
Dec 23, 2021
25360ef
fix fuzzerDirectedEdge build
Dec 24, 2021
ac4b918
Fix fuzzer programs
isaacbrodsky Dec 27, 2021
1145bce
remove logging
isaacbrodsky Dec 27, 2021
cd14266
remove h3Println
isaacbrodsky Dec 27, 2021
76532d8
add fuzzerPoylgonToCells
isaacbrodsky Jan 3, 2022
84bc4e9
Update per review
Jan 3, 2022
323d9e9
Merge branch 'master' into llvm-fuzzer-harness
Jan 3, 2022
e04c62c
Add comment on memcpy per review
Jan 3, 2022
0016f1c
Fix potential crash in vertexRotations
Jan 3, 2022
7807131
Merge branch 'master' into llvm-fuzzer-harness
Jan 3, 2022
4b4e623
Catch possible failure in getIcosahedronFaces
Jan 3, 2022
d501e51
Don't assert specific error in testVertex
Jan 3, 2022
9900b82
Bug fixes for directed edge
Jan 13, 2022
d12e315
Merge branch 'master' into llvm-fuzzer-directed-edge
Jan 17, 2022
979ce07
Remove now irrelevant TODO
isaacbrodsky Jan 23, 2022
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/fuzzers/fuzzerGridDisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef struct {
int64_t k;
} inputArgs;

const int64_t MAX_GRID_DISK_SIZE = 0x1000000000;
const int64_t MAX_GRID_DISK_SIZE = 0x10000000;

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size < sizeof(inputArgs)) {
Expand Down
15 changes: 15 additions & 0 deletions src/apps/testapps/testDirectedEdge.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,21 @@ SUITE(directedEdge) {
"getting the origin from a null index returns error");
}

TEST(getDirectedEdgeOriginBadInput) {
H3Index sf;
t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, 9, &sf));
H3Index ring[7] = {0};
t_assertSuccess(H3_EXPORT(gridRingUnsafe)(sf, 1, ring));
H3Index sf2 = ring[0];

H3Index edge;
t_assertSuccess(H3_EXPORT(cellsToDirectedEdge)(sf, sf2, &edge));
H3_SET_RESERVED_BITS(edge, INVALID_DIGIT);
H3Index out;
t_assert(H3_EXPORT(getDirectedEdgeDestination)(edge, &out) == E_FAILED,
"Invalid directed edge fails");
}

TEST(getDirectedEdgeDestination) {
H3Index hexagon = 0x891ea6d6533ffff;

Expand Down
13 changes: 13 additions & 0 deletions src/apps/testapps/testGridDisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ SUITE(gridDisk) {
t_assert(out == origin, "Moving to self goes to self");
}

TEST(h3NeighborRotations_invalid) {
// This is undefined behavior, but it's helpful for it to make sense.
H3Index origin = 0x811d7ffffffffffL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything special about this particular H3 index?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - I just needed a known good index as I wanted the only rotations to be under test.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my info, is there any difference between indexes with the L suffix or without? Should we be consistent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All valid H3 indexes would only be valid integers as 64 bit, so no I don't believe so.

int rotations = 0;
H3Index out;
t_assert(h3NeighborRotations(origin, -1, &rotations, &out) == E_FAILED,
"Invalid direction fails (-1)");
t_assert(h3NeighborRotations(origin, 7, &rotations, &out) == E_FAILED,
"Invalid direction fails (7)");
t_assert(h3NeighborRotations(origin, 100, &rotations, &out) == E_FAILED,
"Invalid direction fails (100)");
}

TEST(cwOffsetPent) {
// Try to find a case where h3NeighborRotations would not pass the
// cwOffsetPent check, and would hit a line marked as unreachable.
Expand Down
4 changes: 3 additions & 1 deletion src/h3lib/lib/algos.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ H3Error h3NeighborRotations(H3Index origin, Direction dir, int *rotations,
H3Index *out) {
H3Index current = origin;

if (dir < CENTER_DIGIT || dir >= INVALID_DIGIT) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my info, what does CENTER_DIGIT even do? Returns the current index?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is my expectation

return E_FAILED;
}
for (int i = 0; i < *rotations; i++) {
dir = _rotate60ccw(dir);
}
Expand All @@ -352,7 +355,6 @@ H3Error h3NeighborRotations(H3Index origin, Direction dir, int *rotations,
int r = H3_GET_RESOLUTION(current) - 1;
while (true) {
if (r == -1) {
// TODO: dir may be invalid here (verify via fuzzerDirectedEdge)
H3_SET_BASE_CELL(current, baseCellNeighbors[oldBaseCell][dir]);
newRotations = baseCellNeighbor60CCWRots[oldBaseCell][dir];

Expand Down