Don't guess a higher maxzoom than is allowed for manual selection

If maxzoom + detail > 32, some geometric operations are undefined
This commit is contained in:
Eric Fischer 2018-07-25 11:10:56 -07:00
parent 206c75f0ab
commit 856c055857
3 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,7 @@
## 1.30.2
* Don't guess a higher maxzoom than is allowed for manual selection
## 1.30.1 ## 1.30.1
* Ensure that per-feature minzoom and maxzoom are integers * Ensure that per-feature minzoom and maxzoom are integers

View File

@ -1975,8 +1975,11 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
if (maxzoom < 0) { if (maxzoom < 0) {
maxzoom = 0; maxzoom = 0;
} }
if (maxzoom > MAX_ZOOM) { if (maxzoom > 32 - full_detail) {
maxzoom = MAX_ZOOM; maxzoom = 32 - full_detail;
}
if (maxzoom > 33 - low_detail) { // that is, maxzoom - 1 > 32 - low_detail
maxzoom = 33 - low_detail;
} }
if (!quiet) { if (!quiet) {
@ -1991,8 +1994,11 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
if (mz < 0) { if (mz < 0) {
mz = 0; mz = 0;
} }
if (mz > MAX_ZOOM) { if (mz > 32 - full_detail) {
mz = MAX_ZOOM; mz = 32 - full_detail;
}
if (mz > 33 - low_detail) { // that is, mz - 1 > 32 - low_detail
mz = 33 - low_detail;
} }
if (mz > maxzoom || count <= 0) { if (mz > maxzoom || count <= 0) {
@ -2993,6 +2999,10 @@ int main(int argc, char **argv) {
maxzoom = 32 - full_detail; maxzoom = 32 - full_detail;
fprintf(stderr, "Highest supported zoom with detail %d is %d\n", full_detail, maxzoom); fprintf(stderr, "Highest supported zoom with detail %d is %d\n", full_detail, maxzoom);
} }
if (maxzoom > 33 - low_detail) { // that is, maxzoom - 1 > 32 - low_detail
maxzoom = 33 - low_detail;
fprintf(stderr, "Highest supported zoom with low detail %d is %d\n", low_detail, maxzoom);
}
} }
if (maxzoom > MAX_ZOOM) { if (maxzoom > MAX_ZOOM) {
maxzoom = MAX_ZOOM; maxzoom = MAX_ZOOM;

View File

@ -1,6 +1,6 @@
#ifndef VERSION_HPP #ifndef VERSION_HPP
#define VERSION_HPP #define VERSION_HPP
#define VERSION "v1.30.1" #define VERSION "v1.30.2"
#endif #endif