The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

+6 -5
+6 -5
src/xrt/ipc/server/ipc_server_process.c
··· 687 687 } 688 688 } 689 689 690 - // if our currently-set active primary application is not 690 + // if there is a currently-set active primary application and it is not 691 691 // actually active/displayable, use the fallback application 692 692 // instead. 693 - volatile struct ipc_client_state *ics = &s->threads[s->global_state.active_client_index].ics; 694 - if (!(ics->client_state.session_overlay == false && s->global_state.active_client_index >= 0 && 695 - ics->client_state.session_active)) { 696 - s->global_state.active_client_index = fallback_active_application; 693 + if (s->global_state.active_client_index >= 0) { 694 + volatile struct ipc_client_state *ics = &s->threads[s->global_state.active_client_index].ics; 695 + if (!(ics->client_state.session_overlay == false && ics->client_state.session_active)) { 696 + s->global_state.active_client_index = fallback_active_application; 697 + } 697 698 } 698 699 699 700