mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 20:08:20 +00:00
Fix crash with comma or colon at the top level.
This commit is contained in:
parent
e7184989ec
commit
264abd48de
@ -171,6 +171,10 @@ json_object *json_parse(FILE *f, json_object *current) {
|
||||
/////////////////////////// Comma
|
||||
|
||||
if (c == ',') {
|
||||
if (current == NULL) {
|
||||
json_error("comma at top level");
|
||||
}
|
||||
|
||||
if (current->parent == NULL ||
|
||||
(current->parent->type != JSON_ARRAY &&
|
||||
current->parent->type != JSON_HASH)) {
|
||||
@ -183,6 +187,10 @@ json_object *json_parse(FILE *f, json_object *current) {
|
||||
/////////////////////////// Colon
|
||||
|
||||
if (c == ':') {
|
||||
if (current == NULL) {
|
||||
json_error("colon at top level");
|
||||
}
|
||||
|
||||
if (current->parent == NULL || current->parent->type != JSON_HASH) {
|
||||
json_error(": not in hash\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user