summaryrefslogtreecommitdiff
path: root/json_object.c
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2016-01-11 12:15:54 +0100
committerEven Rouault <even.rouault@spatialys.com>2016-01-11 12:15:54 +0100
commit77a4276a8c210e1faa2e8c13421e9a3d62772340 (patch)
tree1fc67d6c101870b1ffd9c4d1784434153bcfb26e /json_object.c
parent537f8bcbdbdc10ffa7673199a0be82ca4eb56ec8 (diff)
downloadjson-c-77a4276a8c210e1faa2e8c13421e9a3d62772340.tar.gz
Fix various potential null ptr deref and int32 overflows
This fix errors that can happen when ingesting very large JSON files when hitting the maximum heap size of the process.
Diffstat (limited to 'json_object.c')
-rw-r--r--json_object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/json_object.c b/json_object.c
index e611103..821ae10 100644
--- a/json_object.c
+++ b/json_object.c
@@ -934,6 +934,11 @@ struct json_object* json_object_new_array(void)
jso->_delete = &json_object_array_delete;
jso->_to_json_string = &json_object_array_to_json_string;
jso->o.c_array = array_list_new(&json_object_array_entry_free);
+ if(jso->o.c_array == NULL)
+ {
+ free(jso);
+ return NULL;
+ }
return jso;
}