Guard against null keys and values in tileset metadata

This commit is contained in:
Eric Fischer
2017-10-27 17:38:07 -07:00
parent 4c7de922ce
commit d13e08c9b5
3 changed files with 39 additions and 14 deletions
+5
View File
@@ -192,6 +192,11 @@ 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);
}
fprintq(stdout, (char *) name);
printf(": ");
fprintq(stdout, (char *) value);