diff options
author | Peter Kim <pk15950@gmail.com> | 2021-08-06 11:55:00 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2021-08-06 11:55:00 +0300 |
commit | 151eed752b01970fdd3cbf69405211b310b80f74 (patch) | |
tree | 2b151a4a5343cc636e88c8bdd87ae3b9f7ebf124 /source/blender/windowmanager/xr/intern/wm_xr_actionmap.c | |
parent | d98791a106ffd1546ec476f3f38caeedd6f99047 (diff) |
Fix invalid XR action map indices after alloc
Although the relevant structs (wmXrRuntime/XrActionMap/
XrActionMapItem) are zero-allocated, the selected and active action
map indices need to be initialized to -1 to prevent potential
out-of-bounds list access.
Diffstat (limited to 'source/blender/windowmanager/xr/intern/wm_xr_actionmap.c')
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr_actionmap.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c b/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c index 7673f2aa212..f9ad34b5a9b 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c @@ -256,6 +256,7 @@ XrActionMapItem *WM_xr_actionmap_item_new(XrActionMap *actionmap, if (ami_prev) { WM_xr_actionmap_item_ensure_unique(actionmap, ami); } + ami->selbinding = -1; BLI_addtail(&actionmap->items, ami); @@ -398,6 +399,7 @@ XrActionMap *WM_xr_actionmap_new(wmXrRuntimeData *runtime, const char *name, boo if (am_prev) { WM_xr_actionmap_ensure_unique(runtime, am); } + am->selitem = -1; BLI_addtail(&runtime->actionmaps, am); |