[subset] Keep bimap consistent if only one of the internal maps is in error.

This commit is contained in:
Garret Rieger 2021-07-16 14:06:55 -07:00
parent 48edbef96f
commit 6269866bdd
2 changed files with 7 additions and 1 deletions

View File

@ -58,10 +58,15 @@ struct hb_bimap_t
void set (hb_codepoint_t lhs, hb_codepoint_t rhs)
{
if (in_error ()) return;
if (unlikely (lhs == HB_MAP_VALUE_INVALID)) return;
if (unlikely (rhs == HB_MAP_VALUE_INVALID)) { del (lhs); return; }
forw_map.set (lhs, rhs);
if (in_error ()) return;
back_map.set (rhs, lhs);
if (in_error ()) forw_map.del (lhs);
}
hb_codepoint_t get (hb_codepoint_t lhs) const { return forw_map.get (lhs); }

View File

@ -2788,7 +2788,8 @@ struct VariationStore
hb_inc_bimap_t region_map;
for (unsigned int i = 0; i < inner_maps.length; i++)
(src+src->dataSets[i]).collect_region_refs (region_map, inner_maps[i]);
if (region_map.in_error()) return_trace (false);
if (region_map.in_error())
return_trace (false);
region_map.sort ();
if (unlikely (!regions.serialize_serialize (c, &(src+src->regions), region_map)))