Jonathan Metzman | 8264b31 | 2018-03-29 11:59:58 -0700 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "fuzz/Fuzz.h" |
| 9 | #include "src/core/SkFontMgrPriv.h" |
| 10 | #include "tools/fonts/TestFontMgr.h" |
Jonathan Metzman | 8264b31 | 2018-03-29 11:59:58 -0700 | [diff] [blame] | 11 | |
Kevin Lubick | 27d4219 | 2018-04-03 12:30:32 -0400 | [diff] [blame] | 12 | void fuzz_MockGPUCanvas(Fuzz* f); |
Jonathan Metzman | 8264b31 | 2018-03-29 11:59:58 -0700 | [diff] [blame] | 13 | |
| 14 | extern "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 Hu | 5b35f21 | 2020-06-14 19:03:34 +0000 | [diff] [blame] | 23 | if (size > 4000) { |
| 24 | return 0; |
| 25 | } |
Mike Klein | ea3f014 | 2019-03-20 11:12:10 -0500 | [diff] [blame] | 26 | gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr; |
Jonathan Metzman | 8264b31 | 2018-03-29 11:59:58 -0700 | [diff] [blame] | 27 | auto fuzz = Fuzz(SkData::MakeWithoutCopy(data, size)); |
Kevin Lubick | 27d4219 | 2018-04-03 12:30:32 -0400 | [diff] [blame] | 28 | fuzz_MockGPUCanvas(&fuzz); |
Jonathan Metzman | 8264b31 | 2018-03-29 11:59:58 -0700 | [diff] [blame] | 29 | return 0; |
| 30 | } |
| 31 | } // extern "C" |