mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:17:45 +00:00
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. :^)
This commit is contained in:
parent
560109bd42
commit
49d0b9e808
3 changed files with 25 additions and 21 deletions
|
@ -8,9 +8,8 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size)
|
||||
{
|
||||
ByteBuffer font_data = ByteBuffer::copy(data, size);
|
||||
(void)TTF::Font::try_load_from_memory(font_data);
|
||||
(void)TTF::Font::try_load_from_externally_owned_memory({ data, size });
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue