From: Marius Vlad Date: Wed, 15 Feb 2023 10:19:42 +0000 (+0200) Subject: shell: Check for invalid outputs passed on when activating X-Git-Tag: 17.90.0~44 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fagl-compositor.git;a=commitdiff_plain;h=02fcb317161c08bcf02093a74abe18d4a4392335 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 Change-Id: I732283fc16841e0e57ddbec5d8bd2333d5028433 --- 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 &&