Skip to content

Commit

Permalink
layershell: check if layer is valid (#9156)
Browse files Browse the repository at this point in the history
fixes compositor crash when client tried to create a layer surface with
invalid layer argument
  • Loading branch information
heather7283 authored Jan 24, 2025
1 parent 0e5d03a commit 9b3f713
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/protocols/LayerShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
return;
}

if UNLIKELY (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
pMgr->error(ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER, "Invalid layer");
return;
}

const auto RESOURCE = m_vLayers.emplace_back(makeShared<CLayerShellResource>(makeShared<CZwlrLayerSurfaceV1>(CLIENT, pMgr->version(), id), SURF, namespace_, PMONITOR, layer));

if UNLIKELY (!RESOURCE->good()) {
Expand Down

0 comments on commit 9b3f713

Please sign in to comment.