From 49d0b9e808584663da116b2dc50e7dfc2c247b60 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 4 Jul 2021 20:21:24 +0200 Subject: 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. :^) --- Meta/Lagom/Fuzzers/FuzzTTF.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Meta/Lagom/Fuzzers') diff --git a/Meta/Lagom/Fuzzers/FuzzTTF.cpp b/Meta/Lagom/Fuzzers/FuzzTTF.cpp index f02962a437..a4214857f2 100644 --- a/Meta/Lagom/Fuzzers/FuzzTTF.cpp +++ b/Meta/Lagom/Fuzzers/FuzzTTF.cpp @@ -8,9 +8,8 @@ #include #include -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; } -- cgit v1.2.3