Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
10BC0 Bug fixes for h3SetToLinkedGeo by isaacbrodsky · Pull Request #560 · uber/h3 · GitHub
Nothing Special   »   [go: up one dir, main page]

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
c236195
Bug fixes for h3SetToLinkedGeo
Jan 13, 2022
cf58c53
Fix vertex graph leaking on error
isaacbrodsky Jan 16, 2022
3d63277
Merge branch 'master' into llvm-fuzzer-h3-set-to-linked-geo
Jan 17, 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
19 changes: 5 additions & 14 deletions src/apps/fuzzers/fuzzerH3SetToLinkedGeo.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,17 @@
#include "h3api.h"
#include "utility.h"

typedef struct {
H3Index h3Set[1024];
int sz;
} inputArgs;

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size < sizeof(inputArgs)) {
return 0;
}
const inputArgs *args = (const inputArgs *)data;
if (args->sz >= 1024) {
return 0;
}
const H3Index *h3Set = (const H3Index *)data;
int sz = size / sizeof(H3Index);

LinkedGeoPolygon polygon;
H3Error err = H3_EXPORT(h3SetToLinkedGeo)(args->h3Set, args->sz, &polygon);
H3Error err = H3_EXPORT(h3SetToLinkedGeo)(h3Set, sz, &polygon);

if (!err) {
H3_EXPORT(destroyLinkedPolygon)(&polygon);
}
return 0;
}

AFL_HARNESS_MAIN(sizeof(inputArgs));
AFL_HARNESS_MAIN(sizeof(H3Index) * 1024);
10 changes: 10 additions & 0 deletions src/apps/testapps/testH3SetToLinkedGeo.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ SUITE(h3SetToLinkedGeo) {
H3_EXPORT(destroyLinkedPolygon)(&polygon);
}

TEST(invalid) {
LinkedGeoPolygon polygon;
H3Index set[] = {0xfffffffffffffff};
int numHexes = ARRAY_SIZE(set);

t_assert(H3_EXPORT(h3SetToLinkedGeo)(set, numHexes, &polygon) ==
E_CELL_INVALID,
"Invalid set fails");
}

TEST(contiguous2) {
LinkedGeoPolygon polygon;
H3Index set[] = {0x8928308291bffff, 0x89283082957ffff};
Expand Down
14 changes: 7 additions & 7 deletions src/apps/testapps/testH3SetToVertexGraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SUITE(h3SetToVertexGraph) {
TEST(empty) {
VertexGraph graph;

h3SetToVertexGraph(NULL, 0, &graph);
t_assertSuccess(h3SetToVertexGraph(NULL, 0, &graph));

t_assert(graph.size == 0, "No edges added to graph");

Expand All @@ -36,7 +36,7 @@ SUITE(h3SetToVertexGraph) {
H3Index set[] = {0x890dab6220bffff};
int numHexes = ARRAY_SIZE(set);

h3SetToVertexGraph(set, numHexes, &graph);
t_assertSuccess(h3SetToVertexGraph(set, numHexes, &graph));
t_assert(graph.size == 6, "All edges of one hex added to graph");

destroyVertexGraph(&graph);
Expand All @@ -47,7 +47,7 @@ SUITE(h3SetToVertexGraph) {
H3Index set[] = {0x8928308291bffff, 0x89283082943ffff};
int numHexes = ARRAY_SIZE(set);

h3SetToVertexGraph(set, numHexes, &graph);
t_assertSuccess(h3SetToVertexGraph(set, numHexes, &graph));
t_assert(graph.size == 12,
"All edges of two non-contiguous hexes added to graph");

Expand All @@ -59,7 +59,7 @@ SUITE(h3SetToVertexGraph) {
H3Index set[] = {0x8928308291bffff, 0x89283082957ffff};
int numHexes = ARRAY_SIZE(set);

h3SetToVertexGraph(set, numHexes, &graph);
t_assertSuccess(h3SetToVertexGraph(set, numHexes, &graph));
t_assert(graph.size == 10, "All edges except 2 shared added to graph");

destroyVertexGraph(&graph);
Expand All @@ -70,7 +70,7 @@ SUITE(h3SetToVertexGraph) {
H3Index set[] = {0x894cc5365afffff, 0x894cc536537ffff};
int numHexes = ARRAY_SIZE(set);

h3SetToVertexGraph(set, numHexes, &graph);
t_assertSuccess(h3SetToVertexGraph(set, numHexes, &graph));
t_assert(graph.size == 12, "All edges except 2 shared added to graph");

destroyVertexGraph(&graph);
Expand All @@ -82,7 +82,7 @@ SUITE(h3SetToVertexGraph) {
0x8928308289bffff};
int numHexes = ARRAY_SIZE(set);

h3SetToVertexGraph(set, numHexes, &graph);
t_assertSuccess(h3SetToVertexGraph(set, numHexes, &graph));
t_assert(graph.size == 3 * 4,
"All edges except 6 shared added to graph");

Expand All @@ -96,7 +96,7 @@ SUITE(h3SetToVertexGraph) {
0x8928308288fffff, 0x89283082883ffff};
int numHexes = ARRAY_SIZE(set);

h3SetToVertexGraph(set, numHexes, &graph);
t_assertSuccess(h3SetToVertexGraph(set, numHexes, &graph));
t_assert(graph.size == (6 * 3) + 6,
"All outer edges and inner hole edges added to graph");

Expand Down
4 changes: 2 additions & 2 deletions src/h3lib/include/algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ void _kRingInternal(H3Index origin, int k, H3Index *out, int *distances,
int maxIdx, int curK);

// Create a vertex graph from a set of hexagons
void h3SetToVertexGraph(const H3Index *h3Set, const int numHexes,
VertexGraph *out);
H3Error h3SetToVertexGraph(const H3Index *h3Set, const int numHexes,
VertexGraph *out);

// Create a LinkedGeoPolygon from a vertex graph
void _vertexGraphToLinkedGeo(VertexGraph *graph, LinkedGeoPolygon *out);
Expand Down
19 changes: 14 additions & 5 deletions src/h3lib/lib/algos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,8 @@ H3Error H3_EXPORT(polygonToCells)(const GeoPolygon *geoPolygon, int res,
* @param numHexes Number of hexagons in the set
* @param graph Output graph
*/
void h3SetToVertexGraph(const H3Index *h3Set, const int numHexes,
VertexGraph *graph) {
H3Error h3SetToVertexGraph(const H3Index *h3Set, const int numHexes,
VertexGraph *graph) {
CellBoundary vertices;
LatLng *fromVtx;
LatLng *toVtx;
Expand All @@ -1044,7 +1044,7 @@ void h3SetToVertexGraph(const H3Index *h3Set, const int numHexes,
// We still need to init the graph, or calls to destroyVertexGraph will
// fail
initVertexGraph(graph, 0, 0);
return;
return E_SUCCESS;
}
int res = H3_GET_RESOLUTION(h3Set[0]);
const int minBuckets = 6;
Expand All @@ -1053,7 +1053,12 @@ void h3SetToVertexGraph(const H3Index *h3Set, const int numHexes,
initVertexGraph(graph, numBuckets, res);
// Iterate through every hexagon
for (int i = 0; i < numHexes; i++) {
H3_EXPORT(cellToBoundary)(h3Set[i], &vertices);
H3Error boundaryErr = H3_EXPORT(cellToBoundary)(h3Set[i], &vertices);
if (boundaryErr) {
// Destroy vertex graph as caller will not know to do so.
destroyVertexGraph(graph);
return boundaryErr;
}
// iterate through every edge
for (int j = 0; j < vertices.numVerts; j++) {
fromVtx = &vertices.verts[j];
Expand All @@ -1070,6 +1075,7 @@ void h3SetToVertexGraph(const H3I 7C33 ndex *h3Set, const int numHexes,
}
}
}
return E_SUCCESS;
}

/**
Expand Down Expand Up @@ -1120,7 +1126,10 @@ void _vertexGraphToLinkedGeo(VertexGraph *graph, LinkedGeoPolygon *out) {
H3Error H3_EXPORT(h3SetToLinkedGeo)(const H3Index *h3Set, const int numHexes,
LinkedGeoPolygon *out) {
VertexGraph graph;
h3SetToVertexGraph(h3Set, numHexes, &graph);
H3Error err = h3SetToVertexGraph(h3Set, numHexes, &graph);
if (err) {
return err;
}
_vertexGraphToLinkedGeo(&graph, out);
if (normalizeMultiPolygon(out)) {
return E_FAILED;
Expand Down
0