mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
WindowServer: Validate cursor type in SetWindowCursor message handler
Fixes #4536.
This commit is contained in:
parent
82f86e35d6
commit
d8899ea65b
3 changed files with 8 additions and 1 deletions
|
@ -45,6 +45,7 @@ enum class StandardCursor {
|
||||||
Drag,
|
Drag,
|
||||||
Move,
|
Move,
|
||||||
Wait,
|
Wait,
|
||||||
|
__Count,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <AK/Badge.h>
|
#include <AK/Badge.h>
|
||||||
#include <AK/SharedBuffer.h>
|
#include <AK/SharedBuffer.h>
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
|
#include <LibGfx/StandardCursor.h>
|
||||||
#include <LibGfx/SystemTheme.h>
|
#include <LibGfx/SystemTheme.h>
|
||||||
#include <WindowServer/AppletManager.h>
|
#include <WindowServer/AppletManager.h>
|
||||||
#include <WindowServer/ClientConnection.h>
|
#include <WindowServer/ClientConnection.h>
|
||||||
|
@ -609,6 +610,10 @@ OwnPtr<Messages::WindowServer::SetWindowCursorResponse> ClientConnection::handle
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto& window = *(*it).value;
|
auto& window = *(*it).value;
|
||||||
|
if (message.cursor_type() < 0 || message.cursor_type() >= (i32)Gfx::StandardCursor::__Count) {
|
||||||
|
did_misbehave("SetWindowCursor: Bad cursor type");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
window.set_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type()));
|
window.set_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type()));
|
||||||
Compositor::the().invalidate_cursor();
|
Compositor::the().invalidate_cursor();
|
||||||
return make<Messages::WindowServer::SetWindowCursorResponse>();
|
return make<Messages::WindowServer::SetWindowCursorResponse>();
|
||||||
|
|
|
@ -177,8 +177,9 @@ RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor)
|
||||||
return WindowManager::the().move_cursor();
|
return WindowManager::the().move_cursor();
|
||||||
case Gfx::StandardCursor::Wait:
|
case Gfx::StandardCursor::Wait:
|
||||||
return WindowManager::the().wait_cursor();
|
return WindowManager::the().wait_cursor();
|
||||||
|
default:
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue