2018-05-03 20:26:10 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2018 Google, LLC
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkData.h"
|
|
|
|
#include "include/core/SkStream.h"
|
|
|
|
#include "modules/skottie/include/Skottie.h"
|
|
|
|
#include "src/core/SkFontMgrPriv.h"
|
|
|
|
#include "tools/fonts/TestFontMgr.h"
|
2018-05-03 20:26:10 +00:00
|
|
|
|
|
|
|
void FuzzSkottieJSON(sk_sp<SkData> bytes) {
|
|
|
|
SkMemoryStream stream(bytes);
|
2018-05-31 16:17:55 +00:00
|
|
|
auto animation = skottie::Animation::Make(&stream);
|
2018-05-03 20:26:10 +00:00
|
|
|
if (!animation) {
|
|
|
|
return;
|
|
|
|
}
|
2018-05-29 17:46:54 +00:00
|
|
|
animation->seek(0.1337f); // A "nothing up my sleeve" number
|
2018-05-03 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(IS_FUZZING_WITH_LIBFUZZER)
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
2019-03-20 16:12:10 +00:00
|
|
|
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
|
2018-05-03 20:26:10 +00:00
|
|
|
auto bytes = SkData::MakeWithoutCopy(data, size);
|
|
|
|
FuzzSkottieJSON(bytes);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|