Skip to content

Commit faa2355

Browse files
committed
Guard UAD action index lookups
Add bounds checks before reading action and effect signatures from the UAD lookup lists. - reject out-of-range action indexes before indexing actionList - reject out-of-range effect indexes before indexing effectList - fail with explicit logs instead of risking undefined behavior on malformed UAD data
1 parent 181f48b commit faa2355

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Applications/CustomControlMap/Actions/Actions.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,21 @@ bool UADRuntime::ExecuteAction(ActionInfo* actionInfo, cb0r_t actionData, Action
3434

3535
if(actionInfo->actionType == ActionType::ACTION)
3636
{
37+
if (action_index.value >= actionList.size())
38+
{
39+
MLOGE(TAG, "Action index out of range: %d (size=%d)", action_index.value, actionList.size());
40+
return false;
41+
}
3742
action_signature = actionList[action_index.value];
3843
MLOGV(TAG, "Executing action - %d", action_signature);
3944
}
4045
else if(actionInfo->actionType == ActionType::EFFECT)
4146
{
47+
if (action_index.value >= effectList.size())
48+
{
49+
MLOGE(TAG, "Effect index out of range: %d (size=%d)", action_index.value, effectList.size());
50+
return false;
51+
}
4252
action_signature = effectList[action_index.value];
4353
MLOGV(TAG, "Executing effect - %d", action_signature);
4454
}
@@ -75,4 +85,4 @@ bool UADRuntime::ExecuteAction(ActionInfo* actionInfo, cb0r_t actionData, Action
7585
}
7686
}
7787
return false;
78-
}
88+
}

0 commit comments

Comments
 (0)