mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-02 01:08:14 +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
|
/////////////////////////// Comma
|
||||||
|
|
||||||
if (c == ',') {
|
if (c == ',') {
|
||||||
|
if (current == NULL) {
|
||||||
|
json_error("comma at top level");
|
||||||
|
}
|
||||||
|
|
||||||
if (current->parent == NULL ||
|
if (current->parent == NULL ||
|
||||||
(current->parent->type != JSON_ARRAY &&
|
(current->parent->type != JSON_ARRAY &&
|
||||||
current->parent->type != JSON_HASH)) {
|
current->parent->type != JSON_HASH)) {
|
||||||
@ -183,6 +187,10 @@ json_object *json_parse(FILE *f, json_object *current) {
|
|||||||
/////////////////////////// Colon
|
/////////////////////////// Colon
|
||||||
|
|
||||||
if (c == ':') {
|
if (c == ':') {
|
||||||
|
if (current == NULL) {
|
||||||
|
json_error("colon at top level");
|
||||||
|
}
|
||||||
|
|
||||||
if (current->parent == NULL || current->parent->type != JSON_HASH) {
|
if (current->parent == NULL || current->parent->type != JSON_HASH) {
|
||||||
json_error(": not in hash\n");
|
json_error(": not in hash\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user