ladybird/Meta/Lagom/Fuzzers/FuzzTTF.cpp
Andreas Kling 49d0b9e808 LibTTF: Memory map TTF fonts instead of reading them into heap memory
All GUI applications currently load all TTF fonts on startup
(to populate the Gfx::FontDatabase. This could probably be smarter.)

Before this patch, everyone would open the files and read them into
heap-allocated storage. Now we simply mmap() them instead. :^)
2021-07-04 21:34:26 +02:00

15 lines
329 B
C++

/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTTF/Font.h>
#include <stddef.h>
#include <stdint.h>
extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size)
{
(void)TTF::Font::try_load_from_externally_owned_memory({ data, size });
return 0;
}