[repacker] ensure link obj indices are valid.
This commit is contained in:
parent
554ed06fac
commit
30e405e470
|
@ -50,11 +50,18 @@ struct graph_t
|
|||
unsigned priority = 0;
|
||||
|
||||
|
||||
bool link_positions_valid ()
|
||||
bool link_positions_valid (unsigned num_objects)
|
||||
{
|
||||
hb_set_t assigned_bytes;
|
||||
for (const auto& l : obj.real_links)
|
||||
{
|
||||
if (l.objidx >= num_objects)
|
||||
{
|
||||
DEBUG_MSG (SUBSET_REPACK, nullptr,
|
||||
"Invalid graph. Invalid object index.");
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned start = l.position;
|
||||
unsigned end = start + l.width - 1;
|
||||
|
||||
|
@ -333,7 +340,7 @@ struct graph_t
|
|||
if (check_success (!vertices_.in_error ()))
|
||||
v->obj = *objects[i];
|
||||
|
||||
check_success (v->link_positions_valid ());
|
||||
check_success (v->link_positions_valid (objects.length));
|
||||
|
||||
if (!removed_nil) continue;
|
||||
// Fix indices to account for removed nil object.
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue