summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-12-15 12:21:49 +0200
committerMarius Vlad <marius.vlad@collabora.com>2023-12-15 12:58:15 +0200
commit675456391e4f74559661206ec919cb5f6cb46f69 (patch)
tree8326caab915bc23367823f3b8876ce7c3267b970
parentbdc551314dc5511be31550b8c2e06641b9a94639 (diff)
shell: Don't assume an output previously set-up
This is unlikely to happen in practice, but discovered while doing a code audit, so let's let be on the safe side and don't attempt to deref as we'll get invalid memory. Bug-AGL: SPEC-5018 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ib874a7194ab3a7019a304ec4c1974824c78b26cc
-rw-r--r--src/shell.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shell.c b/src/shell.c
index f5dc3e3..5157830 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1622,9 +1622,8 @@ shell_set_app_output(struct wl_client *client, struct wl_resource *res,
struct weston_output *woutput = weston_head_get_output(head);
struct ivi_output *ioutput = to_ivi_output(woutput);
struct ivi_surface *surf = ivi_find_app(ivi, app_id);
- struct ivi_output *desktop_last_output = surf->desktop.last_output;
- struct ivi_output *current_completed_output =
- surf->current_completed_output;
+ struct ivi_output *desktop_last_output;
+ struct ivi_output *current_completed_output;
if (!app_id || !ioutput)
return;
@@ -1636,6 +1635,9 @@ shell_set_app_output(struct wl_client *client, struct wl_resource *res,
return;
}
+ desktop_last_output = surf->desktop.last_output;
+ current_completed_output = surf->current_completed_output;
+
if (surf->remote.output)
surf->hidden_layer_output = surf->remote.output;
else