[repacker] fix fuzzer reported stack overflow.

Fixes https://oss-fuzz.com/testcase-detail/6014493291577344.
This commit is contained in:
Garret Rieger authored and Behdad Esfahbod committed 2022-12-07 10:32:56 -07:00
1 parent b17fbc200b
commit 35233d2514
3 files changed
+13

No files matched your search

+5
View File
@@ -1187,6 +1187,11 @@ struct graph_t
}
}
for (unsigned i = 0; i < vertices_.length; i++)
// parents arrays must be accurate or downstream operations like cycle detection
// and sorting won't work correctly.
check_success (!vertices_[i].parents.in_error ());
parents_invalid = false;
}
+8
View File
@@ -393,6 +393,14 @@ hb_resolve_overflows (const T& packed,
return nullptr;
}
if (sorted_graph.in_error ())
{
// Allocations failed somewhere
DEBUG_MSG (SUBSET_REPACK, nullptr,
"Graph is in error, likely due to a memory allocation error.");
return nullptr;
}
if (!hb_resolve_graph_overflows (table_tag, max_rounds, recalculate_extensions, sorted_graph))
return nullptr;