The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: validate formFactor in oxr_xrGetSystem

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2514>

authored by

Simon Zeni and committed by
Marge Bot
943673c4 d0416b1c

+13
+1
src/xrt/state_trackers/oxr/oxr_api_system.c
··· 58 58 OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst, "xrGetSystem"); 59 59 OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, getInfo, XR_TYPE_SYSTEM_GET_INFO); 60 60 OXR_VERIFY_ARG_NOT_NULL(&log, systemId); 61 + OXR_VERIFY_FORM_FACTOR(&log, getInfo->formFactor); 61 62 62 63 struct oxr_system *selected = NULL; 63 64 struct oxr_system *systems[1] = {&inst->system};
+12
src/xrt/state_trackers/oxr/oxr_api_verify.h
··· 304 304 } \ 305 305 } while (false) 306 306 307 + #define OXR_VERIFY_FORM_FACTOR(log, form_factor) \ 308 + do { \ 309 + XrFormFactor _form_factor = (form_factor); \ 310 + if (_form_factor != XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY && \ 311 + _form_factor != XR_FORM_FACTOR_HANDHELD_DISPLAY) { \ 312 + \ 313 + return oxr_error(log, XR_ERROR_FORM_FACTOR_UNSUPPORTED, \ 314 + "(" #form_factor " == 0x%08x) is not a valid form factor", _form_factor); \ 315 + } \ 316 + } while (false) 317 + 318 + 307 319 /* 308 320 * 309 321 * Implementation in oxr_verify.cpp