diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-04 20:21:24 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-04 21:34:26 +0200 |
commit | 49d0b9e808584663da116b2dc50e7dfc2c247b60 (patch) | |
tree | cdb1cf0c8c654157ee641505fd6839341321c0ee /Meta/Lagom/Fuzzers/FuzzTTF.cpp | |
parent | 560109bd42006c15170521c69a0d50d141ef65ec (diff) | |
download | serenity-49d0b9e808584663da116b2dc50e7dfc2c247b60.zip |
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. :^)
Diffstat (limited to 'Meta/Lagom/Fuzzers/FuzzTTF.cpp')
-rw-r--r-- | Meta/Lagom/Fuzzers/FuzzTTF.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
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 <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; } |