Merge pull request #837 from HansolChoe/fix-tokener-parse-ex-fuzzer

Add type checking for parsed objects in tokener_parse_ex_fuzzer
This commit is contained in:
Eric Hawicz
2023-10-19 07:49:32 -04:00
committed by GitHub

View File

@@ -8,9 +8,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
json_tokener *tok = json_tokener_new();
json_object *obj = json_tokener_parse_ex(tok, data1, size);
json_object_object_foreach(obj, key, val) {
(void)json_object_get_type(val);
(void)json_object_get_string(val);
if (json_object_is_type(obj, json_type_object)) {
json_object_object_foreach(obj, key, val) {
(void)json_object_get_type(val);
(void)json_object_get_string(val);
}
}
(void)json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);