From ecdd2aeb85efe95a8a149788f77f05a102e3c3c8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 18 Dec 2022 15:54:55 +0000 Subject: [PATCH] workspace: Don't crash on invalid argument to meta_workspace_index Mitigates: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559 Mitigates: https://bugs.debian.org/1024438 Signed-off-by: Simon McVittie Part-of: --- src/core/workspace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/workspace.c b/src/core/workspace.c index 5acc33420..2e626c0b5 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -704,7 +704,10 @@ meta_workspace_index (MetaWorkspace *workspace) { int ret; + g_return_val_if_fail (META_IS_WORKSPACE (workspace), -1); + ret = g_list_index (workspace->manager->workspaces, workspace); + g_return_val_if_fail (ret >= 0, -1); return ret;