Ralith / openxrs

OpenXR bindings for Rust
Apache License 2.0
282 stars 59 forks source link

`Instance::supports_hand_tracking` might have undefined behavior #169

Closed zmerp closed 2 months ago

zmerp commented 2 months ago

It seems that calling get_system_properties with SystemProperties::next pointing to a structure not supported by the reported extensions would not always result in an error. In fact it seems this is not documented in the OpenXR spec. In particular for the case of Instance::supports_hand_tracking we use SystemHandTrackingPropertiesEXT::out() and then call assume_init() after the get_system_properties succedes, but the field supports_hand_tracking might still contain random values.

I came across this while debugging a crash when using face tracking on a Quest Pro. Our code lead to test also for HTC lip tracking support which somehow resulted as positive, in error. We were also using the out() method.

Ralith commented 2 months ago

Makes sense. Want to make a PR?

zmerp commented 2 months ago

Sure