Browse Source

Improve a bit the coverage of the fuzzer

tags/json-c-0.16-20220414
Julien Voisin GitHub 3 years ago
parent
commit
558d48a6f3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      fuzz/tokener_parse_ex_fuzzer.cc

+ 7
- 1
fuzz/tokener_parse_ex_fuzzer.cc View 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;


Loading…
Cancel
Save