]> granicus.if.org Git - json-c/commitdiff
Improve a bit the coverage of the fuzzer
authorJulien Voisin <jvoisin@users.noreply.github.com>
Wed, 13 Apr 2022 13:42:46 +0000 (15:42 +0200)
committerGitHub <noreply@github.com>
Wed, 13 Apr 2022 13:42:46 +0000 (15:42 +0200)
fuzz/tokener_parse_ex_fuzzer.cc

index 862149be8ca54d8c8a2c0cf7fd1a0ad5a1ff74ce..f058e0fbb2246beb563ca7dc29ff39c3e3dd71f5 100644 (file)
@@ -7,7 +7,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
        const char *data1 = reinterpret_cast<const char *>(data);
        json_tokener *tok = json_tokener_new();
        json_object *obj = json_tokener_parse_ex(tok, data1, size);
-
+       
+       json_object_object_foreach(jobj, key, val) {
+               (void)json_object_get_type(val);
+               (void)json_object_get_string(val);
+       }
+       (void)json_object_to_json_string(obj, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);
+       
        json_object_put(obj);
        json_tokener_free(tok);
        return 0;