Skip to content

Commit

Permalink
Bounds check for explicit inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgerrits committed Feb 27, 2024
1 parent 2f47639 commit 0d8798e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,14 @@ void build_cb_example(VW::multi_ex& cb_ex, VW::example* slot, const VW::ccb_labe
// First time seeing this, initialize the vector with falses so we can start setting each included action.
if (data.include_list.empty()) { data.include_list.assign(data.actions.size(), false); }

for (uint32_t included_action_id : explicit_includes) { data.include_list[included_action_id] = true; }
for (uint32_t included_action_id : explicit_includes)
{
// The action may be included but not actually exist in the list of possible actions.
if (included_action_id < data.actions.size())
{
data.include_list[included_action_id] = true;
}
}
}

// set the available actions in the cb multi-example
Expand Down

0 comments on commit 0d8798e

Please sign in to comment.