Handle allocation failure during glyph_to_sid_map.

This commit is contained in:
Garret Rieger committed 2026-08-18 10:21:58 -06:00
1 parent 07fe5d55a6
commit 2aae9010bd
2 files changed
+11 -2

No files matched your search

+4 -2
View File
@@ -327,7 +327,7 @@ struct Charset0
void collect_glyph_to_sid_map (glyph_to_sid_map_t *mapping, unsigned int num_glyphs) const
{
mapping->resize_dirty (num_glyphs);
if (!mapping->resize_dirty (num_glyphs)) return;
for (hb_codepoint_t gid = 1; gid < num_glyphs; gid++)
mapping->arrayZ[gid] = {sids[gid - 1], gid};
}
@@ -427,10 +427,12 @@ struct Charset1_2 {
void collect_glyph_to_sid_map (glyph_to_sid_map_t *mapping, unsigned int num_glyphs) const
{
mapping->resize_dirty (num_glyphs);
if (!mapping->resize_dirty (num_glyphs)) return;
hb_codepoint_t gid = 1;
if (gid >= num_glyphs)
return;
for (unsigned i = 0;; i++)
{
hb_codepoint_t sid = ranges[i].first;
+7
View File
@@ -518,6 +518,7 @@ struct cff1_subset_plan
glyph_to_sid_map_t *glyph_to_sid_map = acc.cff_accelerator ?
acc.cff_accelerator->glyph_to_sid_map.get_acquire () :
nullptr;
bool created_map = false;
if (!glyph_to_sid_map && acc.cff_accelerator)
{
@@ -525,6 +526,12 @@ struct cff1_subset_plan
glyph_to_sid_map = acc.create_glyph_to_sid_map ();
}
if (!glyph_to_sid_map || glyph_to_sid_map->in_error ())
{
glyph_to_sid_map = nullptr;
created_map = false;
}
auto it = hb_iter (plan->new_to_old_gid_list);
if (it->first == 0) it++;
auto _ = *it;