Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / modules / skottie / fuzz / FuzzSkottieJSON.cpp
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 "include/core/SkData.h"
9 #include "include/core/SkStream.h"
10 #include "modules/skottie/include/Skottie.h"
11 #include "src/core/SkFontMgrPriv.h"
12 #include "tools/fonts/TestFontMgr.h"
13
14 void FuzzSkottieJSON(sk_sp<SkData> bytes) {
15     SkMemoryStream stream(bytes);
16     auto animation = skottie::Animation::Make(&stream);
17     if (!animation) {
18         return;
19     }
20     animation->seek(0.1337f); // A "nothing up my sleeve" number
21 }
22
23 #if defined(SK_BUILD_FOR_LIBFUZZER)
24 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
25     gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
26     auto bytes = SkData::MakeWithoutCopy(data, size);
27     FuzzSkottieJSON(bytes);
28     return 0;
29 }
30 #endif