summaryrefslogtreecommitdiff
path: root/src/protocols/LayerShell.cpp
diff options
context:
space:
mode:
authorheather7283 <142042427+heather7283@users.noreply.github.com>2025-01-24 19:51:31 +0400
committerGitHub <noreply@github.com>2025-01-24 16:51:31 +0100
commit9b3f71390c3db14fd2fa2ff14d533eee34538c55 (patch)
tree35f8dba691562de9dbe43464843878b5b8078843 /src/protocols/LayerShell.cpp
parent0e5d03a5574efb78f06f2723b345bac867d98696 (diff)
layershell: check if layer is valid (#9156)
fixes compositor crash when client tried to create a layer surface with invalid layer argument
Diffstat (limited to 'src/protocols/LayerShell.cpp')
-rw-r--r--src/protocols/LayerShell.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/protocols/LayerShell.cpp b/src/protocols/LayerShell.cpp
index 1533a7c0..c88dc925 100644
--- a/src/protocols/LayerShell.cpp
+++ b/src/protocols/LayerShell.cpp
@@ -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()) {