summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-02-15 12:19:42 +0200
committerMarius Vlad <marius.vlad@collabora.com>2023-02-15 17:47:20 +0200
commit02fcb317161c08bcf02093a74abe18d4a4392335 (patch)
treebc5d52f28fa80473e06625542b8d27ec4732c43d
parentd98b08f1fcb6ff6ccc762f149c8aa53a6921ad60 (diff)
shell: Check for invalid outputs passed on when activating
Connector hot-plugging would generate new wl_output object, which the client might re-use so rather than blindly trusting the client, make sure that the output we're getting is really one suitable. This should avoid getting an incorrect output upon re-plugging in a connector. Bug-AGL: SPEC-4705 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I732283fc16841e0e57ddbec5d8bd2333d5028433
-rw-r--r--src/shell.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/shell.c b/src/shell.c
index 640cc73..15f911d 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1409,10 +1409,20 @@ shell_activate_app(struct wl_client *client,
const char *app_id,
struct wl_resource *output_res)
{
- struct weston_head *head = weston_head_from_resource(output_res);
- struct weston_output *woutput = weston_head_get_output(head);
- struct ivi_compositor *ivi = wl_resource_get_user_data(shell_res);
- struct ivi_output *output = to_ivi_output(woutput);
+ struct weston_head *head;
+ struct weston_output *woutput;
+ struct ivi_compositor *ivi;
+ struct ivi_output *output;
+
+ head = weston_head_from_resource(output_res);
+ if (!head) {
+ weston_log("Invalid output to activate '%s' on\n", app_id);
+ return;
+ }
+
+ woutput = weston_head_get_output(head);
+ ivi = wl_resource_get_user_data(shell_res);
+ output = to_ivi_output(woutput);
if (wl_resource_get_version(shell_res) >=
AGL_SHELL_BOUND_OK_SINCE_VERSION &&