diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-03-30 00:37:30 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-30 11:29:52 +0200 |
commit | 77601e09c8f1c3c9a6cad5e4881262e6fafb6a92 (patch) | |
tree | 61cf6e435637b9db3128b6ab47819e69c3f7cab2 /Userland/Libraries/LibGfx | |
parent | aff774c8ac6ca05a1f19b01833febedd8762f98b (diff) | |
download | serenity-77601e09c8f1c3c9a6cad5e4881262e6fafb6a92.zip |
FontEditor+TextEditor+Playground: Refuse to load device files
This prevents the undefined behaviour that would come up as a result of
doing so. (For example: opening "infinite" devices like /dev/full will
result in an infinite loop until exhaustion of memory)
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r-- | Userland/Libraries/LibGfx/BitmapFont.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp index b26db96c15..376525064b 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -172,6 +172,9 @@ size_t BitmapFont::glyph_count_by_type(FontTypes type) RefPtr<BitmapFont> BitmapFont::load_from_file(const StringView& path) { + if (Core::File::is_device(path)) + return nullptr; + auto file_or_error = MappedFile::map(path); if (file_or_error.is_error()) return nullptr; |