diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-06-02 10:36:44 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-02 10:17:42 +0100 |
commit | cdb070cdfbf5a8eb09ae9d6e42943894ceea4c2a (patch) | |
tree | 6d638beb3a52146b780d660138b25da239d2ed58 | |
parent | 2df6c70b076979effe6d70bd65f4eca0fa97d112 (diff) | |
download | serenity-cdb070cdfbf5a8eb09ae9d6e42943894ceea4c2a.zip |
WindowServer: Don't crash when we can't allocate a bitmap
When the client specifies an absurdly large window size
render_to_cache() fails to allocate a bitmap and crashes.
Refs #7688.
-rw-r--r-- | Userland/Services/WindowServer/WindowFrame.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index 9d4d4fa8c3..2c0637ed6d 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -409,8 +409,14 @@ void WindowFrame::render_to_cache() if (s_tmp_bitmap) s_tmp_bitmap->unref(); s_tmp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, total_frame_rect.size(), scale).leak_ref(); + if (!s_tmp_bitmap) { + dbgln("Could not create bitmap of size {}", total_frame_rect.size()); + return; + } } + VERIFY(s_tmp_bitmap); + auto top_bottom_height = total_frame_rect.height() - window_rect.height(); auto left_right_width = total_frame_rect.width() - window_rect.width(); |