mirror of
https://github.com/hyprwm/Hyprland.git
synced 2026-08-18 11:02:10 +00:00
xwayland: validate ICCCM hint replies (#15450)
Co-authored-by: Pppp1116 <ACCOUNT1_NOREPLY>
This commit is contained in:
@ -249,10 +249,16 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_
|
||||
};
|
||||
|
||||
auto handleWMHints = [&]() {
|
||||
if (reply->value_len == 0)
|
||||
if (reply->type == XCB_ATOM_NONE || reply->value_len == 0) {
|
||||
XSURF->m_hints.reset();
|
||||
return;
|
||||
XSURF->m_hints = makeUnique<xcb_icccm_wm_hints_t>();
|
||||
xcb_icccm_get_wm_hints_from_reply(XSURF->m_hints.get(), reply);
|
||||
}
|
||||
|
||||
auto hints = makeUnique<xcb_icccm_wm_hints_t>();
|
||||
if (!xcb_icccm_get_wm_hints_from_reply(hints.get(), reply))
|
||||
return;
|
||||
|
||||
XSURF->m_hints = std::move(hints);
|
||||
if (!(XSURF->m_hints->flags & XCB_ICCCM_WM_HINT_INPUT))
|
||||
XSURF->m_hints->input = true;
|
||||
};
|
||||
@ -282,12 +288,20 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_
|
||||
};
|
||||
|
||||
auto handleSizeHints = [&]() {
|
||||
if (reply->type != HYPRATOMS["WM_SIZE_HINTS"] || reply->value_len == 0)
|
||||
if (reply->type == XCB_ATOM_NONE || reply->value_len == 0) {
|
||||
XSURF->m_sizeHints.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply->type != HYPRATOMS["WM_SIZE_HINTS"])
|
||||
return;
|
||||
|
||||
XSURF->m_sizeHints = makeUnique<xcb_size_hints_t>();
|
||||
std::memset(XSURF->m_sizeHints.get(), 0, sizeof(xcb_size_hints_t));
|
||||
xcb_icccm_get_wm_size_hints_from_reply(XSURF->m_sizeHints.get(), reply);
|
||||
auto sizeHints = makeUnique<xcb_size_hints_t>();
|
||||
std::memset(sizeHints.get(), 0, sizeof(xcb_size_hints_t));
|
||||
if (!xcb_icccm_get_wm_size_hints_from_reply(sizeHints.get(), reply))
|
||||
return;
|
||||
|
||||
XSURF->m_sizeHints = std::move(sizeHints);
|
||||
|
||||
const int32_t FLAGS = XSURF->m_sizeHints->flags;
|
||||
const bool HASMIN = FLAGS & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user