diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2023-06-01 20:31:29 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-06-01 21:17:29 +0200 |
commit | 522809032a62f9036e60e70517b2c7595f389089 (patch) | |
tree | 12f25c33f366ace9b35b85871a3ba067e26b785b /Userland/Services/WindowServer | |
parent | 7ce4cbfe1d6a3c5cf6dcc6d1059a0a9f8beb4a82 (diff) | |
download | serenity-522809032a62f9036e60e70517b2c7595f389089.zip |
WindowServer: Don't crash when trying to set invalid effects
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r-- | Userland/Services/WindowServer/ConnectionFromClient.cpp | 4 | ||||
-rw-r--r-- | Userland/Services/WindowServer/SystemEffects.h | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index 4bac3d938a..4c4d150f04 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -986,6 +986,10 @@ Messages::WindowServer::SetSystemFontsResponse ConnectionFromClient::set_system_ void ConnectionFromClient::set_system_effects(Vector<bool> const& effects, u8 geometry, u8 tile_window) { + if (effects.size() != to_underlying(Effects::__Count) || geometry >= to_underlying(ShowGeometry::__Count) || tile_window >= to_underlying(TileWindow::__Count)) { + did_misbehave("SetSystemEffects: Bad values"); + return; + } WindowManager::the().apply_system_effects(effects, static_cast<ShowGeometry>(geometry), static_cast<TileWindow>(tile_window)); ConnectionFromClient::for_each_client([&](auto& client) { client.async_update_system_effects(effects); diff --git a/Userland/Services/WindowServer/SystemEffects.h b/Userland/Services/WindowServer/SystemEffects.h index d6f00f4cd0..a0af579f53 100644 --- a/Userland/Services/WindowServer/SystemEffects.h +++ b/Userland/Services/WindowServer/SystemEffects.h @@ -15,14 +15,16 @@ namespace WindowServer { enum class TileWindow : u8 { TileImmediately, ShowTileOverlay, - Never + Never, + __Count }; enum class ShowGeometry : u8 { OnMoveAndResize, OnMoveOnly, OnResizeOnly, - Never + Never, + __Count }; enum class Effects : size_t { |