Detect impossible zoom levels in mbtiles when decoding

This commit is contained in:
Eric Fischer 2017-10-30 12:55:22 -07:00
parent a3e95db0c3
commit e2b9b96ba8

View File

@ -247,6 +247,12 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
int tz = sqlite3_column_int(stmt, 1);
int tx = sqlite3_column_int(stmt, 2);
int ty = sqlite3_column_int(stmt, 3);
if (tz < 0 || tz >= 32) {
fprintf(stderr, "Impossible zoom level %d in mbtiles\n", tz);
exit(EXIT_FAILURE);
}
ty = (1LL << tz) - 1 - ty;
const char *s = (const char *) sqlite3_column_blob(stmt, 0);