[repacker] validate link widths during repacker setup.

This commit is contained in:
Garret Rieger 2022-09-08 23:19:02 +00:00
parent edf7a29595
commit 9e99d08470
2 changed files with 7 additions and 2 deletions

View File

@ -58,6 +58,13 @@ struct graph_t
unsigned start = l.position; unsigned start = l.position;
unsigned end = start + l.width - 1; unsigned end = start + l.width - 1;
if (unlikely (l.width < 2 || l.width > 4))
{
DEBUG_MSG (SUBSET_REPACK, nullptr,
"Invalid graph. Invalid link width.");
return false;
}
if (unlikely (end >= table_size ())) if (unlikely (end >= table_size ()))
{ {
DEBUG_MSG (SUBSET_REPACK, nullptr, DEBUG_MSG (SUBSET_REPACK, nullptr,

View File

@ -111,8 +111,6 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
if (links[i].parent >= num_objects if (links[i].parent >= num_objects
|| links[i].child > links[i].parent) // Enforces DAG graph || links[i].child > links[i].parent) // Enforces DAG graph
goto end; goto end;
if (links[i].width < 2 || links[i].width > 4) goto end;
} }
add_links_to_objects (objects, num_objects, add_links_to_objects (objects, num_objects,