mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 03:55:00 +00:00
Guard against null data in the mbtiles file when decoding
This commit is contained in:
parent
ec00ac2516
commit
25bf3957d1
@ -1,3 +1,7 @@
|
||||
## 1.34.6
|
||||
|
||||
* Fix crash when there are null entries in the metadata table
|
||||
|
||||
## 1.34.5
|
||||
|
||||
* Fix line numbers in GeoJSON feature parsing error messages
|
||||
|
20
decode.cpp
20
decode.cpp
@ -306,17 +306,17 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
const unsigned char *name = sqlite3_column_text(stmt2, 0);
|
||||
const unsigned char *value = sqlite3_column_text(stmt2, 1);
|
||||
|
||||
if (name == NULL || value == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null metadata\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (exclude_meta.count((char *) name) == 0) {
|
||||
if (within) {
|
||||
state.json_comma_newline();
|
||||
}
|
||||
within = 1;
|
||||
|
||||
if (name == NULL || value == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null metadata\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
state.json_write_string((char *) name);
|
||||
state.json_write_string((char *) value);
|
||||
}
|
||||
@ -413,6 +413,11 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
ty = (1LL << tz) - 1 - ty;
|
||||
const char *s = (const char *) sqlite3_column_blob(stmt, 0);
|
||||
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null entry in tiles table\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
handle(std::string(s, len), tz, tx, ty, to_decode, pipeline, stats, state);
|
||||
}
|
||||
|
||||
@ -449,6 +454,11 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
int len = sqlite3_column_bytes(stmt, 0);
|
||||
const char *s = (const char *) sqlite3_column_blob(stmt, 0);
|
||||
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "Corrupt mbtiles file: null entry in tiles table\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (z != oz) {
|
||||
fprintf(stderr, "%s: Warning: using tile %d/%u/%u instead of %d/%u/%u\n", fname, z, x, y, oz, ox, oy);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v1.34.5"
|
||||
#define VERSION "v1.34.6"
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user