1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 06:14:58 +00:00

WindowServer: Don't crash when trying to set invalid effects

This commit is contained in:
Ben Wiederhake 2023-06-01 20:31:29 +02:00 committed by Andreas Kling
parent 7ce4cbfe1d
commit 522809032a
2 changed files with 8 additions and 2 deletions

View file

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

View file

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