Guard against impossible zoom level

This commit is contained in:
Eric Fischer 2017-10-27 17:40:39 -07:00
parent d13e08c9b5
commit dfbb13e7db

View File

@ -24,6 +24,11 @@ void enumerate(char *fname) {
long long x = sqlite3_column_int(stmt, 1); long long x = sqlite3_column_int(stmt, 1);
long long y = sqlite3_column_int(stmt, 2); long long y = sqlite3_column_int(stmt, 2);
if (zoom < 0 || zoom > 31) {
fprintf(stderr, "Corrupt mbtiles file: impossible zoom level %lld\n", zoom);
exit(EXIT_FAILURE);
}
y = (1LL << zoom) - 1 - y; y = (1LL << zoom) - 1 - y;
printf("%s %lld %lld %lld\n", fname, zoom, x, y); printf("%s %lld %lld %lld\n", fname, zoom, x, y);
} }