mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
ipc: Fix session deactivation negative array index access
It is possible for s->global_state.active_client_index to be -1 when update_server_state_locked is called: ipc_server_activate_session is only called from ipc_handle_compositor_predict_frame, which is only called from ipc_compositor_wait_frame. So it is possible to deactivate a session that was never activated.
This commit is contained in:
parent
2c48daff5d
commit
ef47498137
|
@ -687,13 +687,14 @@ update_server_state_locked(struct ipc_server *s)
|
|||
}
|
||||
}
|
||||
|
||||
// if our currently-set active primary application is not
|
||||
// if there is a currently-set active primary application and it is not
|
||||
// actually active/displayable, use the fallback application
|
||||
// instead.
|
||||
volatile struct ipc_client_state *ics = &s->threads[s->global_state.active_client_index].ics;
|
||||
if (!(ics->client_state.session_overlay == false && s->global_state.active_client_index >= 0 &&
|
||||
ics->client_state.session_active)) {
|
||||
s->global_state.active_client_index = fallback_active_application;
|
||||
if (s->global_state.active_client_index >= 0) {
|
||||
volatile struct ipc_client_state *ics = &s->threads[s->global_state.active_client_index].ics;
|
||||
if (!(ics->client_state.session_overlay == false && ics->client_state.session_active)) {
|
||||
s->global_state.active_client_index = fallback_active_application;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue