Raise tippecanoe-decode tile size limit to 250 MB (#299)

* Raise tippecanoe-decode tile size limit to 250 MB

* Update version and changelog
This commit is contained in:
Erica Fischer
2024-11-21 09:17:22 -08:00
committed by GitHub
parent 905b58cdf4
commit 11e3196c9a
3 changed files with 17 additions and 10 deletions
+4
View File
@@ -1,3 +1,7 @@
# 2.70.1
* Raise tippecanoe-decode limit on the size of individual tiles
# 2.70.0 # 2.70.0
* Performance improvements to tippecanoe-overzoom with attribute exclusion * Performance improvements to tippecanoe-overzoom with attribute exclusion
+12 -9
View File
@@ -247,23 +247,26 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
if (fd >= 0) { if (fd >= 0) {
struct stat st; struct stat st;
if (fstat(fd, &st) == 0) { if (fstat(fd, &st) == 0) {
if (st.st_size < 50 * 1024 * 1024) { char *map = (char *) mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
char *map = (char *) mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (map != NULL && map != MAP_FAILED) {
if (map != NULL && map != MAP_FAILED) { if (strcmp(map, "SQLite format 3") != 0 && strncmp(map, "PMTiles", 7) != 0) {
if (strcmp(map, "SQLite format 3") != 0 && strncmp(map, "PMTiles", 7) != 0) { if (z >= 0) {
if (z >= 0) { if (st.st_size > 250 * 1024 * 1024) {
fprintf(stderr, "%s: unrealistically large single-tile size %zu\n", fname, (size_t) st.st_size);
exit(EXIT_MEMORY);
} else {
std::string s = std::string(map, st.st_size); std::string s = std::string(map, st.st_size);
handle(s, z, x, y, to_decode, pipeline, stats, state, coordinate_mode); handle(s, z, x, y, to_decode, pipeline, stats, state, coordinate_mode);
munmap(map, st.st_size); munmap(map, st.st_size);
return; return;
} else {
fprintf(stderr, "Must specify zoom/x/y to decode a single pbf file\n");
exit(EXIT_ARGS);
} }
} else {
fprintf(stderr, "Must specify zoom/x/y to decode a single pbf file\n");
exit(EXIT_ARGS);
} }
} }
munmap(map, st.st_size);
} }
munmap(map, st.st_size);
} else { } else {
perror("fstat"); perror("fstat");
} }
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP #ifndef VERSION_HPP
#define VERSION_HPP #define VERSION_HPP
#define VERSION "v2.70.0" #define VERSION "v2.70.1"
#endif #endif