blob: a18088c44e7ea01d5256d97d8e5e5c0888bc8f88 [file] [log] [blame]
Jonathan Metzman8264b312018-03-29 11:59:58 -07001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "fuzz/Fuzz.h"
9#include "src/core/SkFontMgrPriv.h"
10#include "tools/fonts/TestFontMgr.h"
Jonathan Metzman8264b312018-03-29 11:59:58 -070011
Kevin Lubick27d42192018-04-03 12:30:32 -040012void fuzz_MockGPUCanvas(Fuzz* f);
Jonathan Metzman8264b312018-03-29 11:59:58 -070013
14extern "C" {
15
16 // Set default LSAN options.
17 const char *__lsan_default_options() {
18 // Don't print the list of LSAN suppressions on every execution.
19 return "print_suppressions=0";
20 }
21
22 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
Zepeng Hu5b35f212020-06-14 19:03:34 +000023 if (size > 4000) {
24 return 0;
25 }
Mike Kleinea3f0142019-03-20 11:12:10 -050026 gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
Jonathan Metzman8264b312018-03-29 11:59:58 -070027 auto fuzz = Fuzz(SkData::MakeWithoutCopy(data, size));
Kevin Lubick27d42192018-04-03 12:30:32 -040028 fuzz_MockGPUCanvas(&fuzz);
Jonathan Metzman8264b312018-03-29 11:59:58 -070029 return 0;
30 }
31} // extern "C"