[subset] fail reference blob in face builder if allocation for table sorting fails.

Fixes https://oss-fuzz.com/testcase-detail/5041767803125760
This commit is contained in:
Garret Rieger 2021-08-06 10:45:38 -07:00
parent e5bfd49ae5
commit 8c0c217b5a
2 changed files with 6 additions and 0 deletions

View File

@ -690,6 +690,12 @@ _hb_face_builder_data_reference_blob (hb_face_builder_data_t *data)
// Sort the tags so that produced face is deterministic.
hb_vector_t<hb_pair_t <hb_tag_t, hb_blob_t*>> sorted_entries;
data->tables.iter () | hb_sink (sorted_entries);
if (unlikely (sorted_entries.in_error ()))
{
hb_free (buf);
return nullptr;
}
sorted_entries.qsort (compare_entries);
bool ret = f->serialize_single (&c, sfnt_tag, + sorted_entries.iter());