Skip to content

Commit

Permalink
Fix UB in Instance::supports_<prop>()
Browse files Browse the repository at this point in the history
  • Loading branch information
zarik5 committed Sep 15, 2024
1 parent d8ea555 commit baa266f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openxr/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ impl Instance {

#[inline]
pub fn supports_render_model_loading(&self, system: SystemId) -> Result<bool> {
if self.exts().fb_render_model.is_none() {
return Err(sys::Result::ERROR_EXTENSION_NOT_PRESENT);
}
unsafe {
let mut render_model = sys::SystemRenderModelPropertiesFB::out(ptr::null_mut());
let mut p = sys::SystemProperties::out(&mut render_model as *mut _ as _);
Expand All @@ -168,6 +171,9 @@ impl Instance {

#[inline]
pub fn supports_hand_tracking(&self, system: SystemId) -> Result<bool> {
if self.exts().ext_hand_interaction.is_none() {
return Err(sys::Result::ERROR_EXTENSION_NOT_PRESENT);
}
unsafe {
let mut hand = sys::SystemHandTrackingPropertiesEXT::out(ptr::null_mut());
let mut p = sys::SystemProperties::out(&mut hand as *mut _ as _);
Expand Down

0 comments on commit baa266f

Please sign in to comment.