Skip to content

Conversation

@zmerp
Copy link
Member

@zmerp zmerp commented Sep 13, 2024

This PR attempts to fix a crash reported when enabling face tracking on the Quest Pro.

This PR fixes undefined behavior using a specific solution. Before we were calling System<props>::out() which returns a MaybeUninit, and immediately call assume_uninit(). Doing so only the corresponding BaseOutStructure fields are initialized, that is ty and next. The other fields are filled with random values. Beside this, calling assume_uninit() after attempting to get the properties with get_system_properties is not enough. The OpenXR spec doesn't say to return an error if the next pointer is populated with an unknown structure. So after the get_system_properties call, the System<props> struct might still contain random values. Because of this we should ditch the out() method and manually initialize the structure. The upstream openxrs crate suffers from the same bug, but only concerning the hand tracking extension. That instance of the bug hasn't surfaced yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants