mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
st/oxr: More strictly verify xrSyncActions input in advance.
This commit is contained in:
parent
f7e8a6f9f9
commit
4516ed9b22
|
@ -157,7 +157,7 @@ oxr_xrSyncActions(XrSession session, const XrActionsSyncInfo *syncInfo)
|
|||
struct oxr_action_set *act_set = NULL;
|
||||
OXR_VERIFY_ACTIONSET_NOT_NULL(&log, syncInfo->activeActionSets[i].actionSet, act_set);
|
||||
|
||||
XrResult res = oxr_verify_subaction_path_sync(&log, sess->sys->inst,
|
||||
XrResult res = oxr_verify_subaction_path_sync(&log, sess->sys->inst, act_set,
|
||||
syncInfo->activeActionSets[i].subactionPath, i);
|
||||
if (res != XR_SUCCESS) {
|
||||
return res;
|
||||
|
|
|
@ -276,7 +276,11 @@ oxr_verify_subaction_paths_create(struct oxr_logger *log,
|
|||
* Verify a set of subaction paths for action sync.
|
||||
*/
|
||||
XrResult
|
||||
oxr_verify_subaction_path_sync(struct oxr_logger *log, const struct oxr_instance *inst, XrPath path, uint32_t index);
|
||||
oxr_verify_subaction_path_sync(struct oxr_logger *log,
|
||||
const struct oxr_instance *inst,
|
||||
const struct oxr_action_set *act_set,
|
||||
XrPath path,
|
||||
uint32_t index);
|
||||
|
||||
/*!
|
||||
* Verify a set of subaction paths for action state get.
|
||||
|
|
|
@ -317,28 +317,33 @@ oxr_verify_subaction_paths_create(struct oxr_logger *log,
|
|||
}
|
||||
|
||||
XrResult
|
||||
oxr_verify_subaction_path_sync(struct oxr_logger *log, const struct oxr_instance *inst, XrPath path, uint32_t index)
|
||||
oxr_verify_subaction_path_sync(struct oxr_logger *log,
|
||||
const struct oxr_instance *inst,
|
||||
const struct oxr_action_set *act_set,
|
||||
XrPath path,
|
||||
uint32_t index)
|
||||
{
|
||||
#define VERIFY_PATH(X) \
|
||||
else if (path == inst->path_cache.X) \
|
||||
{ \
|
||||
return XR_SUCCESS; \
|
||||
}
|
||||
if (path == XR_NULL_PATH) {
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
OXR_FOR_EACH_SUBACTION_PATH(VERIFY_PATH)
|
||||
struct oxr_subaction_paths subaction_paths = {0};
|
||||
if (!oxr_classify_subaction_paths(log, inst, 1, &path, &subaction_paths)) {
|
||||
const char *str = NULL;
|
||||
size_t length = 0;
|
||||
|
||||
#undef VERIFY_PATH
|
||||
|
||||
const char *str = NULL;
|
||||
size_t length = 0;
|
||||
|
||||
oxr_path_get_string(log, inst, path, &str, &length);
|
||||
return oxr_error(log, XR_ERROR_PATH_INVALID,
|
||||
"(actionSets[%i].subactionPath == '%s') path "
|
||||
"is not a valid subaction path.",
|
||||
index, str);
|
||||
oxr_path_get_string(log, inst, path, &str, &length);
|
||||
return oxr_error(log, XR_ERROR_PATH_INVALID,
|
||||
"(actionSets[%i].subactionPath == '%s') path "
|
||||
"is not a valid subaction path.",
|
||||
index, str);
|
||||
}
|
||||
if (!oxr_subaction_paths_is_subset_of(&subaction_paths, &(act_set->data->permitted_subaction_paths))) {
|
||||
return oxr_error(log, XR_ERROR_PATH_UNSUPPORTED,
|
||||
"(actionSets[%i].subactionPath) action set '%s' has no "
|
||||
"actions defined with the specified subaction path",
|
||||
index, act_set != NULL ? act_set->data->name : "NULL");
|
||||
}
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
XrResult
|
||||
|
|
Loading…
Reference in a new issue