1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

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)
This commit is contained in:
Idan Horowitz 2021-03-30 00:37:30 +03:00 committed by Andreas Kling
parent aff774c8ac
commit 77601e09c8
4 changed files with 31 additions and 2 deletions

View file

@ -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;