1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:08:12 +00:00

WindowServer: Add sanity checks to create_window IPC

This commit is contained in:
Matthew Jones 2021-06-02 21:21:57 -06:00 committed by Andreas Kling
parent ef92493aba
commit 0ff09d4f74
3 changed files with 10 additions and 2 deletions

View file

@ -465,6 +465,11 @@ Messages::WindowServer::CreateWindowResponse ClientConnection::create_window(Gfx
}
}
if (type < 0 || type >= (i32)WindowType::_Count) {
did_misbehave("CreateWindow with a bad type");
return nullptr;
}
int window_id = m_next_window_id++;
auto window = Window::construct(*this, (WindowType)type, window_id, modal, minimizable, frameless, resizable, fullscreen, accessory, parent_window);
@ -492,7 +497,8 @@ Messages::WindowServer::CreateWindowResponse ClientConnection::create_window(Gfx
window->set_alpha_hit_threshold(alpha_hit_threshold);
window->set_size_increment(size_increment);
window->set_base_size(base_size);
window->set_resize_aspect_ratio(resize_aspect_ratio);
if (resize_aspect_ratio.has_value() && !resize_aspect_ratio.value().is_null())
window->set_resize_aspect_ratio(resize_aspect_ratio);
window->invalidate(true, true);
if (window->type() == WindowType::Applet)
AppletManager::the().add_applet(*window);