You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

tokener_parse_ex_fuzzer.cc 613 B

12345678910111213141516171819202122
  1. #include <stdint.h>
  2. #include <json.h>
  3. extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
  4. {
  5. const char *data1 = reinterpret_cast<const char *>(data);
  6. json_tokener *tok = json_tokener_new();
  7. json_object *obj = json_tokener_parse_ex(tok, data1, size);
  8. if (json_object_is_type(obj, json_type_object)) {
  9. json_object_object_foreach(obj, key, val) {
  10. (void)json_object_get_type(val);
  11. (void)json_object_get_string(val);
  12. }
  13. }
  14. (void)json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);
  15. json_object_put(obj);
  16. json_tokener_free(tok);
  17. return 0;
  18. }