1 /* 2 * Copyright 2018 Google, LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "SkData.h" 9 #include "SkJSON.h" 10 #include "SkStream.h" 11 FuzzJSON(sk_sp<SkData> bytes)12void FuzzJSON(sk_sp<SkData> bytes) { 13 skjson::DOM dom(static_cast<const char*>(bytes->data()), bytes->size()); 14 SkDynamicMemoryWStream wstream; 15 dom.write(&wstream); 16 } 17 18 #if defined(IS_FUZZING_WITH_LIBFUZZER) LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)19extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 20 auto bytes = SkData::MakeWithoutCopy(data, size); 21 FuzzJSON(bytes); 22 return 0; 23 } 24 #endif 25