[repacker] check duplicate() for success.

Fixes fuzzer testcase https://oss-fuzz.com/testcase-detail/5475787333828608.
This commit is contained in:
Garret Rieger 2023-01-24 00:52:26 +00:00 committed by Behdad Esfahbod
parent 6b72a4ddb0
commit e4fff64ce3
2 changed files with 8 additions and 1 deletions

View File

@ -700,6 +700,9 @@ struct graph_t
}
}
if (in_error ())
return false;
if (!made_changes)
return false;
@ -833,7 +836,11 @@ struct graph_t
if (index_map.has (node_idx))
return;
index_map.set (node_idx, duplicate (node_idx));
unsigned clone_idx = duplicate (node_idx);
if (!check_success (clone_idx != (unsigned) -1))
return;
index_map.set (node_idx, clone_idx);
for (const auto& l : object (node_idx).all_links ()) {
duplicate_subgraph (l.objidx, index_map);
}