Skip to content

Commit

Permalink
Abort polygon parsing early if we know the input is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
dfellis committed Oct 13, 2024
1 parent ad7dddc commit d3a5a77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/apps/filters/h3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,10 @@ H3Error polygonStringToGeoPolygon(FILE *fp, char *polygonString,
if (curDepth > maxDepth) {
maxDepth = curDepth;
}
if (curDepth > 4) {
// This is beyond the depth for a valid input, so we abort early
return E_FAILED;
}
strPos++;
continue;
}
Expand Down

0 comments on commit d3a5a77

Please sign in to comment.