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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "SkData.h"
|
2018-12-14 16:42:53 +00:00
|
|
|
#include "SkFontMgrPriv.h"
|
2018-05-03 20:26:10 +00:00
|
|
|
#include "SkStream.h"
|
2018-12-14 16:42:53 +00:00
|
|
|
#include "Skottie.h"
|
2019-03-20 16:08:46 +00:00
|
|
|
#include "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) {
|
2018-12-14 16:42:53 +00:00
|
|
|
gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr;
|
2018-05-03 20:26:10 +00:00
|
|
|
auto bytes = SkData::MakeWithoutCopy(data, size);
|
|
|
|
FuzzSkottieJSON(bytes);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|